-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
33 lines (32 loc) · 1.14 KB
/
webpack.config.js
File metadata and controls
33 lines (32 loc) · 1.14 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
import path from 'path';
import CompressionPlugin from 'compression-webpack-plugin';
import BrotliPlugin from 'brotli-webpack-plugin';
export default {
mode: 'production', // Set to 'production' for optimizations
entry: './src/index.js', // Your entry file
output: {
path: path.resolve('dist'), // Output directory
filename: '[name].bundle.js', // Output filename pattern
},
module: {
rules: [
// Your loaders (e.g., Babel, CSS loaders)
],
},
plugins: [
new CompressionPlugin({
filename: '[path].gz[query]', // Output filename pattern
algorithm: 'gzip', // Compression algorithm
test: /\.(js|jsx|css|html|svg)$/, // File types to compress
threshold: 10240, // Only compress files larger than 10KB
minRatio: 0.8, // Minimum compression ratio
deleteOriginalAssets: false, // Keep original files
}),
new BrotliPlugin({
filename: '[path].br[query]', // Output filename pattern for Brotli
test: /\.(js|jsx|css|html|svg)$/, // File types to compress
threshold: 10240, // Only compress files larger than 10KB
minRatio: 0.8, // Minimum compression ratio
}),
],
};