Nuxt.js: Occurs in the IE browser: objects do not support the find property or method

Created on 22 Jun 2017  路  4Comments  路  Source: nuxt/nuxt.js

0

Error method replication

Parent component锛歛.vue

Subcomponents锛歛b.vue

ab.vue

this.$emit('increment')

a.vue


methods: {
  incrementTotal: function () {
  this.total += 1
}
}

This question is available on Nuxt.js community (#c823)

Most helpful comment

Ok, @akmur suggested working solution.
You need to add polyfill for the array methods. It can be done via script tag (that is the solution I tested now and works for me), but it should be also possible as a plugin via webpack.
Just add

module.exports = {
  head: {
    script: [
      { src: 'https://cdn.polyfill.io/v2/polyfill.js?features=String.prototype.includes,Array.prototype.find,Promise' }
    ],
  }
}

to your nuxt.config.js

After I fixed this issue, I encountered Explorer errors about some other array methods, so I will probably go for some general polyfill, but maybe this solution will be enough for you.

All 4 comments

I guess you are not using vuex? I have similar issue, but I don't use $emit only vuex to handle state, and from some initial research have hypothesis that this is vome .find method in vuex used (while it it is not supported in any IE - see browser compatibility here: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find

But hadn't fund direct culprit yet.

Ok, @akmur suggested working solution.
You need to add polyfill for the array methods. It can be done via script tag (that is the solution I tested now and works for me), but it should be also possible as a plugin via webpack.
Just add

module.exports = {
  head: {
    script: [
      { src: 'https://cdn.polyfill.io/v2/polyfill.js?features=String.prototype.includes,Array.prototype.find,Promise' }
    ],
  }
}

to your nuxt.config.js

After I fixed this issue, I encountered Explorer errors about some other array methods, so I will probably go for some general polyfill, but maybe this solution will be enough for you.

Ok, just tried clean starter app, then run npm run generate (just adding custom router base in nuxt.config.js) and in IE 12 and below there is this error in console:
Object doesn't support property or method 'find'
Tested in BrowserStack
See yourself at: http://hadora.xyz/test-nuxt/

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vadimsg picture vadimsg  路  3Comments

surmon-china picture surmon-china  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments

VincentLoy picture VincentLoy  路  3Comments