forked from titaniumnetwork-dev/Ultraviolet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (43 loc) · 1.07 KB
/
webpack.config.js
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 webpack from 'webpack';
import { fileURLToPath } from 'url';
import TerserPlugin from 'terser-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import { resolve } from 'path';
const isDevelopment = process.env.NODE_ENV !== 'production';
/**
* @type {webpack.Configuration}
*/
const config = {
mode: isDevelopment ? 'development' : 'production',
entry: {
bundle: fileURLToPath(new URL('./src/rewrite/index.js', import.meta.url)),
handler: fileURLToPath(new URL('./src/uv.handler.js', import.meta.url)),
sw: fileURLToPath(new URL('./src/uv.sw.js', import.meta.url)),
},
output: {
path: fileURLToPath(new URL('./dist/', import.meta.url)),
filename: 'uv.[name].js',
},
optimization: {
minimize: !isDevelopment,
minimizer: [
new TerserPlugin({
exclude: ['uv.config.js'],
}),
],
},
plugins: [
new CopyPlugin({
patterns: [
{
from: fileURLToPath(new URL('./src/uv.config.js', import.meta.url)),
},
],
}),
],
performance: {
// suppress "entrypoint size limit" warning
hints: false,
},
};
export default config;