Commit d87f6c60 authored by Evan You's avatar Evan You

notes about css in deps + extraction

parent f0f8f67a
...@@ -24,6 +24,11 @@ const config = merge(base, { ...@@ -24,6 +24,11 @@ const config = merge(base, {
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
name: 'vendor', name: 'vendor',
minChunks: function (module) { minChunks: function (module) {
// do not put CSS into the vendor chunk so that it can be extracted
// otherwise extract-text-webpack-plugin will be confused
if (/\.(css|styl(us)?|less|sass|scss)(\?[^.]+)?$/.test(module.userRequest)) {
return false
}
// this assumes your vendor imports exist in the node_modules directory // this assumes your vendor imports exist in the node_modules directory
return module.context && module.context.indexOf('node_modules') !== -1; return module.context && module.context.indexOf('node_modules') !== -1;
} }
......
...@@ -16,6 +16,8 @@ module.exports = merge(base, { ...@@ -16,6 +16,8 @@ module.exports = merge(base, {
'create-api': './create-api-server.js' 'create-api': './create-api-server.js'
} }
}, },
// note: if a dependency needs to be processed by webpack, e.g. it exports
// CSS or raw *.vue files, do not include it in externals!
externals: Object.keys(require('../package.json').dependencies), externals: Object.keys(require('../package.json').dependencies),
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment