-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
110 lines (109 loc) · 2.5 KB
/
webpack.config.js
File metadata and controls
110 lines (109 loc) · 2.5 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const OverwolfPlugin = require('./overwolf.webpack')
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = env => {
return {
target: 'web',
entry: {
background: './src/background/background.tsx',
desktop: './src/desktop/desktop.tsx',
settings: './src/settings/settings.tsx'
},
devtool: env['removeSourceMap'] ? false : 'inline-source-map',
module: {
rules: [
{
test: /\.(ts|js)x?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/i,
oneOf: [
{
test: /\.module\.css$/,
assert: {
type: 'css'
},
use: [
{loader: 'style-loader'},
{
loader: 'css-loader',
options: {
modules: {
exportLocalsConvention: 'camelCase',
localIdentName: '[local]'
}
}
}
]
},
{
use: ['style-loader', 'css-loader']
}
]
},
{
test: /\.(png|jpe?g|ttf|webp|svg)$/,
type: 'asset'
}
]
},
resolve: {
extensions: ['.ts', '.js', '.tsx', 'jsx'],
plugins: [new TsconfigPathsPlugin({configFile: './tsconfig.json'})]
},
output: {
path: path.resolve(__dirname, 'dist/'),
filename: 'js/[name].bundle.js',
clean: true,
environment: {
module: true
},
assetModuleFilename: 'assets/[hash][ext][query]'
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false
}
},
extractComments: false
})
]
},
performance: {
maxAssetSize: 51200000,
maxEntrypointSize: 51200000
},
plugins: [
new CopyPlugin({
patterns: [
{from: 'public/OWassets', to: './OWassets'},
{from: 'public/manifest.json', to: './manifest.json'}
]
}),
new HtmlWebpackPlugin({
template: './src/background/background.html',
filename: path.resolve(__dirname, './dist/background.html'),
chunks: ['background']
}),
new HtmlWebpackPlugin({
template: './src/desktop/desktop.html',
filename: path.resolve(__dirname, './dist/desktop.html'),
chunks: ['desktop']
}),
new HtmlWebpackPlugin({
template: './src/settings/settings.html',
filename: path.resolve(__dirname, './dist/settings.html'),
chunks: ['settings']
}),
new OverwolfPlugin(env)
]
}
}