-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
38 lines (36 loc) · 931 Bytes
/
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
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = (env, argv) => {
const IS_PRODUCTION = argv.mode === 'production';
return {
devtool: 'source-map',
entry: './src/scripts/main.tsx',
output: { filename: 'content_script.js', path: path.resolve(__dirname, IS_PRODUCTION ? 'publish' : 'dist') },
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: 'ts-loader',
},
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'src/manifest.json' },
{ from: 'src/icons' },
{ from: 'node_modules/crx-hotreload/hot-reload.js' },
],
}),
],
};
};