webpack icon indicating copy to clipboard operation
webpack copied to clipboard

Vendor's code ES6 not work in IE11

Open v1ar31 opened this issue 9 years ago • 3 comments

My app contains vuejs (work), vue-resourse (not work). When I tried to use es6-promise-polyfill in code, then app.[hash].js polyfilled and worked in IE11, but vendors.[hash].js not work. Babel-polyfill is not work eather.

How can I fix with problem? How can I polyfill vendors.[hash].js?

v1ar31 avatar Nov 20 '17 18:11 v1ar31

  • What means "don't work"? What error?
  • How exactly did you try to use the polyfill?

You don't have to "polyfill vendors.[hash].js" - polyfills are applied globally.

Usually, you just have to add this at the very top of `main.js

import 'es6-promise/auto'

LinusBorg avatar Nov 20 '17 19:11 LinusBorg

@LinusBorg I know this is closed and old, but I've been searching this issue for a few days now trying to solve. Theoretically, every npm package pulled into our projects should be polyfilled? Continually getting syntax errors with IE11. The syntax error actually looks like it related to => syntax used in Vue's core code.

Added import 'es6-promise/auto as you suggested, but unfortunately didn't resolve the issue.

If it helps, my babelrc file looks like this:

{
  "presets": [
    ["env", {
      "modules": false,
      "targets": {
        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
      }
    }],
    "stage-2"
  ],
  "plugins": ["transform-vue-jsx", "transform-runtime", "transform-es2015-arrow-functions"]
}

Anything else I could I attempt? Thanks for your time.

chasegiunta avatar Jun 14 '18 01:06 chasegiunta

So, apparently this is a somewhat popular issue with babel's relationship to npm packages:

https://github.com/babel/babel-loader/issues/171

A good catch-all solution I found is https://github.com/sheerun/targets-webpack-plugin but it does add a significant amount of time (and probably size) to your final bundle.

chasegiunta avatar Jun 14 '18 02:06 chasegiunta