forked from opensumi/ide-startup-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.worker.config.js
55 lines (52 loc) · 1.42 KB
/
webpack.worker.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
55
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const path = require('path');
const { ProgressPlugin } = require('webpack');
const tsConfigPath = path.join(__dirname, './tsconfig.json');
const distDir = path.join(__dirname, './dist');
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
entry: require.resolve('@opensumi/ide-extension/lib/hosted/worker.host-preload.js'),
output: {
filename: 'worker.host.js',
path: distDir,
},
target: 'webworker',
node: {
net: 'empty',
},
mode: 'production',
devtool: 'none',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json', '.less'],
plugins: [
new TsconfigPathsPlugin({
configFile: tsConfigPath,
}),
],
},
module: {
// https://github.com/webpack/webpack/issues/196#issuecomment-397606728
exprContextCritical: false,
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
configFile: tsConfigPath,
happyPackMode: true,
transpileOnly: true,
compilerOptions: {
target: 'es2017',
},
},
},
],
},
resolveLoader: {
modules: [path.join(__dirname, '../node_modules')],
extensions: ['.ts', '.tsx', '.js', '.json', '.less'],
mainFields: ['loader', 'main'],
moduleExtensions: ['-loader'],
},
plugins: [isProd ? null : new ProgressPlugin()].filter(Boolean),
};