-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
111 lines (105 loc) · 2.06 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const dist = path.resolve(__dirname, 'dist');
const general = {
mode: 'development',
output: {
path: dist,
filename: '[name].js',
},
externals: {
vscode: 'commonjs vscode'
},
devtool: 'source-map',
experiments: {
syncWebAssembly: true,
asyncWebAssembly: true,
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.html$/i,
loader: 'html-loader',
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
},
};
const extension = {
...general,
target: 'node',
entry: {
'extension-vscode': './extension/index.ts',
},
output: {
...general.output,
libraryTarget: 'commonjs2',
}
};
const webextension = {
...general,
target: 'webworker',
entry: {
'extension-web': './extension/index.ts',
},
output: {
...general.output,
libraryTarget: 'commonjs2',
},
resolve: {
...general.resolve,
mainFields: ['browser', 'module', 'main'],
extensions: ['.ts', '.js'],
fallback: {
buffer: require.resolve('buffer/'),
assert: require.resolve("assert/"),
util: require.resolve("util/"),
stream: require.resolve('stream-browserify'),
zlib: require.resolve('browserify-zlib'),
fs: false,
},
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser'
})
],
};
const webview = {
...general,
target: 'web',
entry: {
webview_nifti: './webview/nifti/index.ts'
},
output: {
...general.output,
filename: 'webview/nifti/index.js',
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'webview/nifti/index.html', to: 'webview/nifti/index.html' },
],
}),
],
};
module.exports = [extension, webextension, webview];