-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathwebpack.extension.config.ts
More file actions
63 lines (62 loc) · 1.63 KB
/
webpack.extension.config.ts
File metadata and controls
63 lines (62 loc) · 1.63 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
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import path from 'node:path';
import { IgnorePlugin, type Configuration } from 'webpack';
const config: Configuration = {
mode: 'production',
entry: {
contentScript: './src/extension/content/index.ts',
background: './src/extension/background/index.ts',
devtools: './src/extension/devtools/devtools.ts',
react: './src/extension/react/index.tsx',
},
output: {
path: path.resolve(__dirname, 'dist/extension'),
filename: '[name].js',
clean: true,
},
plugins: [
new HtmlWebpackPlugin({
template: './src/extension/index.html',
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'manifest.json'),
to: path.resolve(__dirname, 'dist/extension'),
},
{
from: path.resolve(__dirname, 'src/extension/devtools/devtools.html'),
to: path.resolve(__dirname, 'dist/extension'),
},
],
}),
new IgnorePlugin({
resourceRegExp: /..\/test_data\/test_data$/, // to ignore test_data in production build
}),
],
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: 'ts-loader',
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
generator: {
filename: 'fonts/[name][ext]',
},
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
};
export default config;