question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use splitChunks webpack system with vue cli 3?

See original GitHub issue

Hi, I wanna use the splitChunk option of webpack. I’ve created the vie.config.js file and put the following in there:

module.exports = {
  configureWebpack: config => {
		if (process.env.NODE_ENV === 'production') {
			config.splitChunks = {
				cacheGroups: {
					node_vendors: {
						test: /[\\/]node_modules[\\/]/,
						chunks: "all",
						priority: 1
					}
				}
			}
		}
  }
}

But when I build my app, nothing gets changed. I’ve also posted in stackoverflow: https://stackoverflow.com/questions/51816020/how-to-break-the-js-files-into-chunks-in-vue-cli-3-with-webpack-performance-obje/ Did not get any help from there as well. Can anyone please reply?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

24reactions
isaumyacommented, Jan 30, 2019

Hi all, I’m using the following code inside vue.config.js file and it is working, So, I’m sharing my code here:

module.exports = {
  configureWebpack:{
    optimization: {
      splitChunks: {
        minSize: 10000,
        maxSize: 200000,
      }
    }
  }
}

Hope this helps.

24reactions
vue-botcommented, Aug 13, 2018

Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue.js - How to correctly set optimization.splitChunks ...
I'm looking to modify the splitChunks.automaticNameDelimiter Webpack setting when using Vue CLI vue.config.js settings, but I don't quite ...
Read more >
SplitChunksPlugin - webpack
Assign modules to a cache group by module layer. splitChunks.maxSize. number = 0. Using maxSize (either globally optimization.splitChunks.maxSize ...
Read more >
How to use Webpack code splitting with Vue.js - Medium
Webpack provides a code splitting feature which allows you to create chunks which can then be loaded on demand. We will use: the...
Read more >
Build Targets - Vue CLI
When you run vue-cli-service build , you can specify different build targets via the --target option. This allows you to use the same...
Read more >
A mostly complete guide to webpack 5 (2020)
Should you learn webpack? Today CLI tools as create-react-app or Vue cli abstract away most of the configuration, and provide sane defaults.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found