forked from enyancc/vscode-ext-color-highlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
53 lines (49 loc) · 1.07 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
const baseConfig = {
entry: './src/main.js',
externals: {
'vscode': 'vscode'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { targets: 'defaults' }]],
plugins: ['@babel/transform-runtime'],
}
}
}
]
}
};
const nodeConfig = {
...baseConfig,
target: 'node',
output: {
libraryTarget: 'commonjs2',
filename: 'extension-node.js',
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
}
};
const webConfig = {
...baseConfig,
target: 'webworker',
output: {
libraryTarget: 'commonjs2',
filename: 'extension-web.js',
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
},
resolve: {
fallback: {
'path': require.resolve('path-browserify'),
'fs': false
}
}
};
module.exports = [nodeConfig, webConfig];
if (process.env.NODE_ENVIRONMENT !== 'production') {
module.exports.devtool = 'source-map';
}