Skip to content

Commit d87f6c6

Browse files
committed
notes about css in deps + extraction
1 parent f0f8f67 commit d87f6c6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

build/webpack.client.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ const config = merge(base, {
2424
new webpack.optimize.CommonsChunkPlugin({
2525
name: 'vendor',
2626
minChunks: function (module) {
27+
// do not put CSS into the vendor chunk so that it can be extracted
28+
// otherwise extract-text-webpack-plugin will be confused
29+
if (/\.(css|styl(us)?|less|sass|scss)(\?[^.]+)?$/.test(module.userRequest)) {
30+
return false
31+
}
2732
// this assumes your vendor imports exist in the node_modules directory
2833
return module.context && module.context.indexOf('node_modules') !== -1;
2934
}

build/webpack.server.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module.exports = merge(base, {
1616
'create-api': './create-api-server.js'
1717
}
1818
},
19+
// note: if a dependency needs to be processed by webpack, e.g. it exports
20+
// CSS or raw *.vue files, do not include it in externals!
1921
externals: Object.keys(require('../package.json').dependencies),
2022
plugins: [
2123
new webpack.DefinePlugin({

0 commit comments

Comments
 (0)