-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.shells.js
63 lines (61 loc) · 1.64 KB
/
webpack.shells.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
entry: {
background: path.resolve(__dirname, 'shells/chrome/background.ts'),
'inject-devtools-api': path.resolve(__dirname, 'shells/chrome/inject-devtools-api.ts'),
devtools: path.resolve(__dirname, 'shells/chrome/devtools.ts'),
'devtools-api-script': path.resolve(__dirname, 'shells/chrome/devtools-api-script.ts')
},
output: {
path: path.resolve(__dirname, 'dist/shells/chrome'),
filename: '[name].js'
},
mode: 'development',
devtool: 'inline-source-map',
optimization: {
minimize: false
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [path.resolve(__dirname, 'dist/shells')],
verbose: true
}),
isProd
? new FileManagerPlugin({
onEnd: {
copy: [
{
source: path.resolve(__dirname, 'dist/devtools'),
destination: 'shells/chrome/devtools'
}
]
}
})
: () => {},
new CopyWebpackPlugin([
{
from: 'shells/**/*',
to: path.resolve(__dirname, 'dist'),
ignore: ['*.ts']
}
])
],
resolve: {
extensions: ['.ts', '.js', '.json']
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
configFile: path.resolve(__dirname, 'tsconfig.shells.json')
}
}
]
}
};