-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.mjs
More file actions
executable file
·46 lines (45 loc) · 1.42 KB
/
webpack.prod.mjs
File metadata and controls
executable file
·46 lines (45 loc) · 1.42 KB
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
37
38
39
40
41
42
43
44
45
46
import { merge } from 'webpack-merge'
import common from './webpack.dev.mjs'
import CompressionPlugin from 'compression-webpack-plugin'
import zlib from 'zlib'
import path, { dirname } from 'path'
import { fileURLToPath } from 'url'
export default merge(common, {
mode: 'production',
target: ['web', 'es5'],
devServer: {
hot: false
},
plugins: [
new CompressionPlugin({
filename: '[path][base].br',
algorithm: 'brotliCompress',
test: /\.(js|css|html|svg)$/,
compressionOptions: {
params: {
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
},
},
threshold: 10240,
minRatio: 0.8,
})
],
resolve: {
alias: {
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
'react/jsx-runtime': 'preact/jsx-runtime',
// Force these to resolve from root node_modules, preventing nested copies
// inside geojson-rbush and mapbox-gl-snap from being bundled separately.
'@turf/meta': path.resolve(dirname(fileURLToPath(import.meta.url)), 'node_modules/@turf/meta'),
'@turf/helpers': path.resolve(dirname(fileURLToPath(import.meta.url)), 'node_modules/@turf/helpers'),
'robust-predicates': path.resolve(dirname(fileURLToPath(import.meta.url)), 'node_modules/robust-predicates')
}
},
performance: {
hints: false,
maxEntrypointSize: 2048000,
maxAssetSize: 2048000
}
})