2022-04-06 05:59:13 -04:00
|
|
|
const { merge } = require('webpack-merge')
|
2019-11-28 05:20:22 -05:00
|
|
|
const TerserPlugin = require('terser-webpack-plugin')
|
2022-04-06 05:59:13 -04:00
|
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
2019-11-28 05:20:22 -05:00
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
2018-03-13 07:19:30 -04:00
|
|
|
|
|
|
|
const base = require('./webpack.config')
|
|
|
|
|
2022-04-06 05:59:13 -04:00
|
|
|
module.exports = merge(
|
2020-03-31 05:12:46 -04:00
|
|
|
base,
|
|
|
|
{
|
|
|
|
mode: 'production',
|
2019-08-06 08:20:02 -04:00
|
|
|
|
2020-03-31 05:12:46 -04:00
|
|
|
// Enable a full source map. Generates a comment linking to the source map
|
2020-04-08 04:35:01 -04:00
|
|
|
devtool: 'hidden-source-map',
|
2018-03-13 07:19:30 -04:00
|
|
|
|
2020-03-31 05:12:46 -04:00
|
|
|
optimization: {
|
|
|
|
// Minify JS (with Terser) and CSS (with cssnano)
|
2021-02-09 10:39:13 -05:00
|
|
|
minimizer: [
|
|
|
|
new TerserPlugin({
|
|
|
|
terserOptions: {
|
2022-03-18 06:13:02 -04:00
|
|
|
keep_classnames: /(Error|Exception)$/,
|
|
|
|
keep_fnames: /(Error|Exception)$/,
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
2021-02-09 10:39:13 -05:00
|
|
|
}),
|
2022-04-06 05:59:13 -04:00
|
|
|
new CssMinimizerPlugin(),
|
2021-04-27 03:52:58 -04:00
|
|
|
],
|
2020-03-31 05:12:46 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
// Extract CSS to a separate file (rather than inlining to a <style> tag)
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
// Output to public/stylesheets directory and append hash for immutable
|
|
|
|
// caching
|
2022-04-06 05:59:13 -04:00
|
|
|
filename: 'stylesheets/[name]-[contenthash].css',
|
2021-04-27 03:52:58 -04:00
|
|
|
}),
|
|
|
|
],
|
2020-01-29 05:25:33 -05:00
|
|
|
},
|
2020-07-02 11:51:38 -04:00
|
|
|
{}
|
2020-03-31 05:12:46 -04:00
|
|
|
)
|