CommonsChunkPlugin is a webpack plugin that helps you bundle common code among your modules into separate bundles.
Questions tagged [commonschunkplugin]
72 questions
2
votes
2 answers
Webpack 4 and code splitting
I was using CommonsChunkplugin to split my codes.Now I'm trying to migrate my project to webpack 4.
Here is the old config code:
entry: {
main: './src/app.js',
vendor:…

javauser35
- 1,177
- 2
- 14
- 34
2
votes
1 answer
Webpack 4 splitchunks, how to force common chunks?
I'm trying to split a project into commons chunks, it'was easy with the old commonChunks plugin because the project is designed to be splitted into kinds of libraries...
With the new splitChunks i cannot achieve the same result. So i came back to a…

Coolhand
- 106
- 1
- 9
2
votes
1 answer
CSS not extracted for common chunk with extract-text-webpack-plugin
Not sure if this is a bug or just my setup, I am using the CommonsChunkPlugin to get a separate common.js for three entry points in my project, and using the extract-text-webpack-plugin to get the css files. My entry points are app, login and…

JerryH
- 115
- 2
- 14
2
votes
0 answers
How can I import dynamically scripts without bundle them together?
I'm trying to dynamically import a script with webpack's magic comments ( using commons chunk plugin ) depending on the some user action.
I've tried this ( lets say that the user's action would load the 'a' script ):
const paths = {
a:…

Thiago Miranda de Oliveira
- 5,790
- 5
- 20
- 24
2
votes
1 answer
Webpack Code splitting with libraryTarget
I have a web application who's (client side) javascript is written in es6 with the main entry point in app.js.
I can bundle it up using webpack, either referencing vendor libraries like jQuery externally, or including them in the bundle - depending…

JamesT
- 2,988
- 23
- 29
2
votes
1 answer
Split "vendor" chunk using webpack 2
I have code splitting config similar to official docs
and everything works perfect - all my node modules are in "vendor" chunk (including "babel-polyfill"). But now I need to move babel-polyfill and all it's dependecies to separate chunk…

Egor Komarov
- 23
- 3
2
votes
0 answers
Webpack multiple vendor bundles
What I'm trying to achieve with webpack is to have 1 core vendor bundle for stable dependencies (react, etc.) and one more vendor bundle for other staff.
I could create one huge vendor bundle with filtering via minChunks.
```
new…

Hello Deadline
- 91
- 1
- 6
2
votes
1 answer
webpack2 CommonsChunkPlugin with manifest file, only generates the last file in the "names[]" array if minChunks is a function
webpack version
2.2.1
I'm trying to add an additional manifest file in order to bypass webpacks runtime code injection issue and enable caching:
https://webpack.js.org/guides/code-splitting-libraries/#manifest-file
however, when passing a function…

silicakes
- 6,364
- 3
- 28
- 39
2
votes
0 answers
Webpack missing modules with CommonsChunk and extract-text-webpack-plugin
I'm following Maxime Fabre's tutorial on Webpack and am trying to get a really simple webpack bundle with 1 entry point and 2 chunks to work. Since both chunks require jquery and mustache, I'm using CommonsChunkPlugin to move the common dependencies…

CoconutFred
- 454
- 3
- 11
1
vote
1 answer
splitChunks-> cacheGroups css compilation silently fail to execute code in output ( provided demo-repository )
I've build a sample minimal-demo repository : https://github.com/fvigotti/webpack-errordemo
the problem is that when I add this (
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true,
…

francesco
- 309
- 1
- 16
1
vote
0 answers
Migrating 2 CommonsChunksPlugin to Webpack 4's splitChunks
I have these settings in a Webpack 2.x config file and I'm migrating to Webpack 4. I know CommonsChunkPlugin is deprecated and I should use optimization.splitChunks, but I couldn't find anywhere in the docs on how to convert two CommonsChunkPlugin…

Siraj Kakeh
- 741
- 6
- 20
1
vote
0 answers
What's the difference between "names" and "chunks" in CommonsChunkPlugin?
What's the difference between those two fields in plugins options?
How are they related to each other?
Which one is executed first, which one second?
How can I pick a package from a chunk info a separate file with these options?
name: string, //…

Green
- 28,742
- 61
- 158
- 247
1
vote
2 answers
Issue using webpack CommonsChunkPlugin for multiple entries
entry: {
page1: '~/page1',
page2: '~/page2',
page3: '~/page3',
lib: ['date-fns', 'lodash'],
vendor: ['vue', 'vuex', 'vue-router']
},
new webpack.optimize.CommonsChunkPlugin({
name: ['vendor', 'lib'],
filename:…

Hari Prakash
- 21
- 2
1
vote
1 answer
How to combine all code-splitted modules into a single file?
I've got an SPA for which I want to split the non-critical code and load it asynchronously right after the critical file is being loaded, but as a single file.
To this end, I'm utilizing import('./module-name') as code-splitting points.
Problem is,…

Daniel Birowsky Popeski
- 8,752
- 12
- 60
- 125
1
vote
1 answer
Independent chunk files with webpack
I am building a component library and I am using Webpack to bundle it. Some components only rely on html templates, css and JavaScript that I've written, but some components require external libraries.
What I'd like to achieve is a vendor.js that…

jokarl
- 1,913
- 2
- 24
- 52