Webpack: Vendor's code ES6 not work in IE11

Created on 20 Nov 2017  路  3Comments  路  Source: vuejs-templates/webpack

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?

question

Most helpful comment

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.

All 3 comments

  • 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 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.

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.

Was this page helpful?
0 / 5 - 0 ratings