2017-03-08 13:41:05 -05:00
|
|
|
var baseConfig = require('./webpackBaseConfig')
|
|
|
|
var webpack = require('webpack')
|
|
|
|
var path = require('path')
|
2018-07-03 16:47:50 -04:00
|
|
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
2018-07-02 16:24:56 -04:00
|
|
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
2016-10-11 03:45:00 -04:00
|
|
|
|
2016-11-02 06:01:26 -04:00
|
|
|
module.exports = [Object.assign({}, baseConfig, {
|
2017-03-08 13:41:05 -05:00
|
|
|
plugins: baseConfig.plugins.concat([
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
'NODE_ENV': JSON.stringify('production')
|
|
|
|
}
|
2018-07-02 16:24:56 -04:00
|
|
|
})
|
2017-03-08 13:41:05 -05:00
|
|
|
]),
|
2016-10-12 05:15:59 -04:00
|
|
|
|
2018-07-02 16:24:56 -04:00
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
new UglifyJsPlugin({
|
|
|
|
parallel: true,
|
|
|
|
cache: true
|
|
|
|
})
|
|
|
|
],
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'async',
|
|
|
|
minChunks: Infinity
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-03-08 13:41:05 -05:00
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'public/build'),
|
|
|
|
publicPath: '/build/',
|
2018-07-02 16:24:56 -04:00
|
|
|
filename: '[id].[name].[hash].js'
|
|
|
|
// baseUrl: '<%- url %>'
|
2017-03-08 13:41:05 -05:00
|
|
|
}
|
2016-11-02 06:01:26 -04:00
|
|
|
}), {
|
2018-07-03 16:47:50 -04:00
|
|
|
// This Chunk is used in the 'save as html' feature.
|
|
|
|
// It is embedded in the html file and contains CSS for styling.
|
|
|
|
|
2017-03-08 13:41:05 -05:00
|
|
|
entry: {
|
|
|
|
htmlExport: path.join(__dirname, 'public/js/htmlExport.js')
|
|
|
|
},
|
2018-07-02 16:24:56 -04:00
|
|
|
|
2017-03-08 13:41:05 -05:00
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'public/build'),
|
|
|
|
publicPath: '/build/',
|
|
|
|
filename: '[name].js'
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
'NODE_ENV': JSON.stringify('production')
|
|
|
|
}
|
|
|
|
}),
|
2018-07-03 16:47:50 -04:00
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: 'html.min.css'
|
|
|
|
})
|
2018-07-02 16:24:56 -04:00
|
|
|
],
|
2018-07-03 16:47:50 -04:00
|
|
|
|
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
new OptimizeCSSAssetsPlugin({})
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2018-07-02 16:24:56 -04:00
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
|
|
|
'css-loader'
|
|
|
|
]
|
|
|
|
}]
|
|
|
|
}
|
2017-03-08 13:41:05 -05:00
|
|
|
}]
|