fix[cssnano]:use official demo of webpack config to avoid temporary bug of build:prod. ps:I have a computer which build:prod well but another computer throw cssnano error. The most amazing thing is that my two computers are same type and project is the same branch. Finally, I add the official config to branch for solving this problem and it works well.
This commit is contained in:
parent
baa7172a70
commit
75ff34d285
|
@ -9,7 +9,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
|
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
// const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
||||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||||
|
|
||||||
function resolve(dir) {
|
function resolve(dir) {
|
||||||
|
@ -140,7 +140,15 @@ const webpackConfig = merge(baseWebpackConfig, {
|
||||||
}),
|
}),
|
||||||
// Compress extracted CSS. We are using this plugin so that possible
|
// Compress extracted CSS. We are using this plugin so that possible
|
||||||
// duplicated CSS from different components can be deduped.
|
// duplicated CSS from different components can be deduped.
|
||||||
// new OptimizeCSSAssetsPlugin()
|
new OptimizeCSSAssetsPlugin({
|
||||||
|
assetNameRegExp: /\.optimize\.css$/g,
|
||||||
|
cssProcessor: require('cssnano'),
|
||||||
|
cssProcessorOptions: {
|
||||||
|
safe: true,
|
||||||
|
discardComments: { removeAll: true }
|
||||||
|
},
|
||||||
|
canPrint: true
|
||||||
|
})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue