-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.prod.mjs
36 lines (34 loc) · 1.21 KB
/
webpack.config.prod.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { join } from 'path';
import TerserPlugin from 'terser-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { merge } from 'webpack-merge';
import { PROutPlugin } from './webpack/prout-plugin.mjs';
import { UpdateParameterStorePlugin } from './webpack/update-parameter-store-plugin.mjs';
import config from './webpack.config.mjs';
const prefix = process.env.BUNDLE_PREFIX ?? '[chunkhash]/';
// eslint-disable-next-line import/no-default-export -- webpack config
export default merge(config, {
mode: 'production',
output: {
filename: `commercial/${prefix}graun.standalone.commercial.js`,
chunkFilename: `commercial/${prefix}graun.[name].commercial.js`,
path: join(import.meta.dirname, 'dist', 'prod', 'artifacts'),
publicPath: 'auto',
clean: true,
},
devtool: 'source-map',
plugins: [
// eslint-disable-next-line @typescript-eslint/no-unsafe-call -- circular-dependency-plugin is not typed
new BundleAnalyzerPlugin({
reportFilename: './commercial-bundle-analyzer-report.html',
analyzerMode: 'static',
openAnalyzer: false,
}),
new UpdateParameterStorePlugin(),
new PROutPlugin(),
],
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
});