-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebpack.webview.config.js
54 lines (52 loc) · 1.32 KB
/
webpack.webview.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
48
49
50
51
52
53
54
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { ProgressPlugin } = require('webpack');
const tsConfigPath = path.join(__dirname, './tsconfig.json');
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
entry: path.join(__dirname, 'webview-host/web-preload.ts'),
node: {
net: 'empty',
child_process: 'empty',
path: 'empty',
url: false,
fs: 'empty',
process: 'mock',
},
output: {
filename: 'webview.js',
path: path.join(__dirname, 'dist/webview'),
},
resolve: {
extensions: ['.ts'],
},
bail: true,
mode: 'production',
devtool: 'false',
module: {
exprContextCritical: false,
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
happyPackMode: true,
transpileOnly: true,
configFile: tsConfigPath,
},
},
],
},
resolveLoader: {
modules: [path.join(__dirname, './node_modules'), path.resolve('node_modules')],
extensions: ['.ts', '.tsx', '.js', '.json', '.less'],
mainFields: ['loader', 'main'],
moduleExtensions: ['-loader'],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'webview-host/webview.html'),
}),
isProd ? null : new ProgressPlugin(),
].filter(Boolean),
};