Skip to content

Disable polyfills in tranform-runtime to prevent dupplicate polyfills. #532

@sudo-suhas

Description

@sudo-suhas

This issue was also discussed here - https://forum.vuejs.org/t/multiple-promise-libraries-being-exported-in-webpack/6610. My thanks to @LinusBorg

Setup

Module Version
Node.js 6.9.2
npm 4.3
vue-cli 2.8.1
vue 2.1.10
webpack 2.2.1
babel 6.22

Issue details

I have a modified version of the vue-js webpack template which I migrated to webpack 2(some time back) and also made other changes.
I have added es6-promise for use with vuex as it needs a Promise library implementation. When I recently used webpack-bundle-analyzer, I saw something odd. A snippet from the vendor.js:

The promise library polyfill is being exported twice. From the discussion with Linus, we were able to conclude that this is happening due to babel-plugin-transform-runtime which, among other things, also introduces polyfills for things likeMap and Promise. This section from babel-loader README is quite relevant but I failed to solve the issue with the bootstrap suggested. Linus suggested that the babel config could be changed to not add polyfills by default:

"plugins": [
  ["transform-runtime", { "polyfill": false}]
]

Are there any polyfills required by vue, vuex and vue-router? I will also try to get rid of the polyfills and check if something breaks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions