Code split by route in VueJS

Share this video with your friends

Send Tweet

In this lesson I show how to use webpack to code split based on route in VueJS. Code splitting is a useful tool to help eliminate unused code and only load what's necessary.

Additional Resources https://router.vuejs.org/en/advanced/lazy-loading.html

Francis
Francis
~ 7 years ago

In addition to this, I had to add chunkFilename: '[name].js' to the webpack conf. output { } object to take advantage of the webpackChunkName comments.

Andrew Del Prete
Andrew Del Prete(instructor)
~ 7 years ago

In addition to this, I had to add chunkFilename: '[name].js' to the webpack conf. output { } object to take advantage of the webpackChunkName comments.

Did you start your project using Vue CLI 3? I wonder if that's the case. I didn't have to add anything else to get it to work. 🤔