Commit f3b6b3d5 authored by Evan You's avatar Evan You

only extract for production

parent 68cdaa80
const ExtractTextPlugin = require('extract-text-webpack-plugin') const ExtractTextPlugin = require('extract-text-webpack-plugin')
const isProd = process.env.NODE_ENV === 'production'
module.exports = { module.exports = {
loaders: { loaders: isProd ? {
stylus: ExtractTextPlugin.extract({ stylus: ExtractTextPlugin.extract({
use: 'css-loader!stylus-loader', use: 'css-loader?minimize!stylus-loader',
fallback: 'vue-style-loader' fallback: 'vue-style-loader'
}) })
}, } : {},
preserveWhitespace: false, preserveWhitespace: false,
postcss: [ postcss: [
require('autoprefixer')({ require('autoprefixer')({
......
...@@ -50,9 +50,16 @@ module.exports = { ...@@ -50,9 +50,16 @@ module.exports = {
maxEntrypointSize: 300000, maxEntrypointSize: 300000,
hints: isProd ? 'warning' : false hints: isProd ? 'warning' : false
}, },
plugins: [ plugins: isProd
new ExtractTextPlugin({ filename: 'common.[chunkhash].css' }) ? [
].concat(isProd new webpack.optimize.UglifyJsPlugin({
? [new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }})] compress: { warnings: false }
: [new FriendlyErrorsPlugin()]) }),
new ExtractTextPlugin({
filename: 'common.[chunkhash].css'
})
]
: [
new FriendlyErrorsPlugin()
]
} }
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