-
Notifications
You must be signed in to change notification settings - Fork 26
/
webpack.config.ts
63 lines (60 loc) · 1.86 KB
/
webpack.config.ts
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
import * as path from 'path';
import * as webpack from 'webpack';
const WarningsToErrorsPlugin = require('warnings-to-errors-webpack-plugin');
// in case you run into any typescript error when configuring `devServer`
// import 'webpack-dev-server';
const nodeConfig: webpack.Configuration = {
mode: 'production',
entry: './test-webpack/node/index.ts',
externals: {
"vscode": "commonjs vscode",
},
target: "node", // vscode extensions run in a Node.js-context
node: {
__dirname: false, // leave the __dirname-behavior intact
},
output: {
path: path.resolve(__dirname, 'dist/node'),
filename: 'foo.node.bundle.js',
},
plugins: [
new WarningsToErrorsPlugin(),
],
stats: {
errorDetails: true,
}
};
/*
const webworkerConfig: webpack.Configuration = {
mode: 'production', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
entry: './test-webpack/webworker/index.ts',
target: 'webworker', // extensions run in a webworker context
output: {
path: path.resolve(__dirname, 'dist/webworker'),
filename: 'foo.webworker.bundle.js',
},
resolve: {
//mainFields: ['module', 'main'],
//extensions: ['.ts', '.js'], // support ts-files and js-files
alias: {
'node-fetch': 'whatwg-fetch',
'object-hash': 'object-hash/dist/object_hash.js',
},
fallback: {
path: require.resolve('path-browserify'),
'node-fetch': require.resolve('whatwg-fetch'),
util: require.resolve('util'),
},
},
plugins: [
new WarningsToErrorsPlugin(),
new webpack.ProvidePlugin({
process: path.resolve(path.join(__dirname, 'node_modules/process/browser.js')), // provide a shim for the global `process` variable
}),
],
externals: {
vscode: 'commonjs vscode', // ignored because it doesn't exist
},
};
*/
module.exports = [nodeConfig];