How can I stop vue cli3 build from including vue.js.min in my chunk-vendors.js file?

时间:2018-09-18 19:31:51

标签: vue.js webpack vue-cli-3

I'm starting from scratch and using the default create project from vue using cli 3. Everything is fine, however I noticed the chunk-vendors.js file contains vue.js.min. I don't want to include that file, how do I tell the vue to not include it in production builds?

1 个答案:

答案 0 :(得分:2)

If you want to exclude Vue from being bundled, use the library build target.

In lib mode, Vue is externalized. This means the bundle will not bundle Vue even if your code imports Vue. If the lib is used via a bundler, it will attempt to load Vue as a dependency through the bundler; otherwise, it falls back to a global Vue variable.