Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Styles not extracted from common chunk #43

Closed
stanshillis opened this issue Dec 3, 2014 · 2 comments
Closed

Styles not extracted from common chunk #43

stanshillis opened this issue Dec 3, 2014 · 2 comments

Comments

@stanshillis
Copy link

I'm using CommonsChunkPlugin together with extract text plugin. I set extract options to be allChunks = true, but it doesn't seems to extract css from the common chunk generated by CommonChunkPlugin. Inside common.bundle.js there is still embedded css.

Is is possible to make extract- text-plugin extract css across all chunks into one css file?

The set-up looks as follows:

var externalLibs = ['jquery', ...];
...
entry: {
            entryOne: 'entryOne.js',
            entryTwo: 'entryTwo.js',
            common: externalLibs
        },
module: {
   loader: [
      { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader?root=' + appRoot) },
   }
}
plugins: [
   new ExtractTextPlugin("styles/default.css", {
      allChunks: true
   }),
   new webpack.optimize.CommonsChunkPlugin("common", "common.bundle.js")
]

entryOne.js and entryTwo.js both require in the same file (say shared.js), which in turn requires in a css file. CommonsChunkPlugin puts shared.js into common.bundle.js, which is fine, but it also carries the css content along with it, it seems.

@sokra
Copy link
Member

sokra commented Dec 3, 2014

Each entry has it own stylesheet, so you need to use new ExtractTextPlugin("styles/[name].css",

@stanshillis
Copy link
Author

Okay, thank you.

@sokra sokra closed this as completed Dec 6, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants