mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-11-08 06:05:25 +00:00
init
This commit is contained in:
47
template/core/webpack.prod.js
Normal file
47
template/core/webpack.prod.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const merge = require('webpack-merge')
|
||||
const baseWebpack = require('./webpack.base')
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const {styleLoaders} = require('./tools')
|
||||
module.exports = merge(baseWebpack, {
|
||||
devtool: '#cheap-module-eval-source-map',
|
||||
module: {
|
||||
rules: styleLoaders({ extract: true, sourceMap: true })
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(['build/*.*']),
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': '"production"'
|
||||
}),
|
||||
new OptimizeCSSPlugin({
|
||||
cssProcessorOptions: {
|
||||
safe: true
|
||||
}
|
||||
}),
|
||||
new ExtractTextPlugin({
|
||||
filename: 'css/[name].[contenthash].css'
|
||||
}),
|
||||
new webpack.HashedModuleIdsPlugin(),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks: function (module) {
|
||||
return (
|
||||
module.resource &&
|
||||
/\.js$/.test(module.resource) &&
|
||||
module.resource.indexOf(
|
||||
path.join(__dirname, '../node_modules')
|
||||
) === 0
|
||||
)
|
||||
}
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
chunks: ['vendor']
|
||||
})
|
||||
]
|
||||
})
|
||||
Reference in New Issue
Block a user