-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.dev.mjs
62 lines (60 loc) · 1.4 KB
/
webpack.dev.mjs
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
import path from 'path';
import { fileURLToPath } from 'url';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
mode: 'development',
entry: {
background: '/src/ts/background.ts',
popup: '/src/ts/popup.ts',
content: '/src/ts/content.ts',
'fetch-override': '/src/ts/fetch-override.ts',
'ace-override': '/src/ts/ace-override.ts',
},
devtool: 'cheap-module-source-map',
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
publicPath: '',
path: path.resolve(__dirname, 'chrome'),
filename: '[name].js',
clean: true,
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
}),
new CopyWebpackPlugin({
patterns: [
{
from: 'src/images',
},
{
from: 'src/manifest.json',
},
],
}),
new HtmlWebpackPlugin({
template: './src/html/popup.html',
filename: 'popup.html',
chunks: ['popup'],
}),
],
};