CommonsChunkPlugin not work with require in .vue files
See original GitHub issueI import moment
module in 3 .vue files, but moment
didn’t be generated in vendor.js

Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
vue-cli & webpack 4: CommonsChunkPlugin · Issue #1421
I am struggling with this problem too. npm run build does not work. I can not find how to update the webpack.prod.conf.js file...
Read more >Uncaught ReferenceError: webpackJsonp in Vue Js
I have suddenly started hitting Uncaught ReferenceError: webpackJsonp in Vue Js. I am fairly new to Js and have just started with Vue ......
Read more >Issue using webpack CommonsChunkPlugin for multiple ...
Coding example for the question Issue using webpack CommonsChunkPlugin for multiple entries-Vue.js.
Read more >4 Ways To Boost Your Vue.js App With Webpack | Codementor
Webpack is an essential tool for VueJS apps, but is notoriously hard ... will need to be in separate files, making them hard...
Read more >Webpack config help - console error - JavaScript - SitePoint
Basically I use VueJS, so main point is use .vue extension files ... I don't have any kind of special config, but it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That is working as expected. Since all 3 of your route components require
moment.js
, and its up to the visitor to decide which route to go to first, webpack has to put it into each of the async bundles.if you want to extract dependencies that are shared amongst your extractred asynv bundles, you have to create another instance of the commonChunks Plugin:
I think it should look like this:
Coincidentally, I learned about this just yesterday through this article:
https://medium.com/@adamrackis/vendor-and-code-splitting-in-webpack-2-6376358f1923#.jyz1nf7v2
…and haven’t tested it. Try it out and see if that works as intended.
@hanai If that solves your problem, please consider closing this issue.