-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to not include core-js polyfills for libraries #1919
Comments
https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#usebuiltins module.exports = {
presets: [
['@vue/app', {
useBuiltIns: false
}]
]
} |
Sorry but it is not easy to locate a bug with such limited information… |
Completely fair. I narrowed it down to a single component that causes the polyfills to be included and pushed again. Can you check out the repo again? https://github.com/wolthers/vue-cli-library-polyfill-bug/commit/6f0bf1f16320c9f9a3b8b1e08a65fb5fea1dc219 and https://github.com/wolthers/vue-cli-library-polyfill-bug/commit/7bddd702897d4d42f08b3f9671b80d71ed25b007 |
Narrowed it down even further. Now the repo is and index file that exports 1 component that looks like this:
|
FYI the imported core-js module is not a polyfill, but a runtime helper (added by https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-computed-properties/src/index.js#L97). But not sure why it even includes ie8 related code in the final build. Will investigate later… |
It seems some babel transforms (like the computed property here) requires runtime helpers / polyfills in a way that makes it difficult to leave the polyfill responsibility to the consuming application. IMO this is more like an issue for this specific transform and there's not much we can do in Vue CLI. I would personally avoid using computed property in order to circumvent the problem. |
Version
3.0.0-rc.5
Reproduction link
https://github.com/wolthers/vue-cli-library-polyfill-bug
Steps to reproduce
git clone https://github.com/wolthers/vue-cli-library-polyfill-bug.git
cd /~/path/to/vue-cli-library-polyfill-bug
npm run build
/dist/vue-cli-library-polyfill-bug.common-report.html
in a browserWhat is expected?
No polyfills should be added to the build (or at least that's what I want to achieve)
What is actually happening?
Polyfills from core-js are included in the build
I'm building a component library and publishing via
vue-cli-service build --target lib....
. I only want to transpile but not include any polyfills, as the implementing application is responsible for polyfilling features. As far as I can see there is no option to achieve this.The text was updated successfully, but these errors were encountered: