-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
47 lines (45 loc) · 1.21 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
47
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const SRC_DIR = path.resolve(__dirname, 'src');
const DEST_DIR = path.resolve(__dirname, 'target');
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
'content_scripts/translate': path.resolve(SRC_DIR, 'content_scripts', 'translate.js'),
'popup/translate': path.resolve(SRC_DIR, 'popup', 'translate.js'),
'options/options': path.resolve(SRC_DIR, 'options', 'options.js')
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'target')
},
module: {
rules: [
{
test: /\.(?:js|mjs|cjs|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: 'defaults' }],
['@babel/preset-react', { targets: 'defaults' }]
],
plugins: [
'@babel/plugin-syntax-jsx'
]
}
}
},
{
test: /\.css/i,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: "postcss-loader" }
]
}
]
}
};