wikijs-fork/dev/webpack/webpack.prod.js

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-01-26 05:32:53 +00:00
const webpack = require('webpack')
const merge = require('webpack-merge')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
2018-01-28 03:06:18 +00:00
const OfflinePlugin = require('offline-plugin')
2018-01-28 02:40:51 +00:00
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin')
2018-01-26 05:32:53 +00:00
const common = require('./webpack.common.js')
console.info(process.cwd())
module.exports = merge(common, {
module: {
rules: []
},
plugins: [
new CleanWebpackPlugin(['assets'], { root: process.cwd() }),
new UglifyJSPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
2018-01-28 02:40:51 +00:00
new ExtractTextPlugin('css/bundle.css'),
2018-01-28 03:06:18 +00:00
new OfflinePlugin({
caches: {
main: [
'js/runtime.js',
'js/vendor.js',
'js/client.js'
],
additional: [':externals:'],
optional: ['*.chunk.js']
}
}),
2018-01-28 02:40:51 +00:00
new DuplicatePackageCheckerPlugin()
2018-01-26 05:32:53 +00:00
]
})