Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

Comments

solving your stackoverflow question#1

Open
carloluis wants to merge 5 commits intolencioni:masterfrom
carloluis:master
Open

solving your stackoverflow question#1
carloluis wants to merge 5 commits intolencioni:masterfrom
carloluis:master

Conversation

@carloluis
Copy link

@carloluis carloluis commented Mar 11, 2018

Updating Webpack config optimization option to:

optimization: {
	runtimeChunk: 'single',
	splitChunks: {
		chunks: 'all',

		cacheGroups: {
			default: {
				enforce: true,
				priority: 1
			},
			vendors: {
				test: /[\\/]node_modules[\\/]/,
				priority: 2,
				name: 'vendors',
				enforce: true,
				chunks: 'all'
			}
		}
	}
}

@lencioni : This Pull request is related to this answer on StackOverflow

More info related to Webpack 4 in this demo project

@carloluis
Copy link
Author

carloluis commented Mar 11, 2018

Comparison

Before

npm run build

screen shot 2018-03-11 at 7 14 17 pm

screen shot 2018-03-11 at 4 59 21 pm

After

npm run dedup

screen shot 2018-03-11 at 7 15 04 pm

screen shot 2018-03-11 at 5 01 05 pm

@lencioni
Copy link
Owner

Thanks for the PR! Unfortunately this isn't quite what I need. I've updated my stackoverflow question to hopefully clarify things a bit. I'm currently trying out creating a cacheGroup for each of these core bundles that uses the function version of test, which seems really close to what I need. My current test is something like this:

test(code, meta) {
  return meta.some((chunk) => {
    return chunk.entryModule.rawRequest === './src/bundles/core.js';
  });
},

but I'm not really sure if this is the right property to look at to make this decision. I think I still need to play around some.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants