forked from Dart-Code/Dart-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
68 lines (62 loc) · 1.76 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
// @ts-check
"use strict";
// Webpack will output the following warnings when building:
//
// WARNING in ./node_modules/ws/lib/buffer-util.js
// Module not found: Error: Can't resolve 'bufferutil' in '/Users/dantup/Dev/Dart-Code/node_modules/ws/lib'
//
// WARNING in ./node_modules/ws/lib/validation.js
// Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/dantup/Dev/Dart-Code/node_modules/ws/lib'
//
// These are caused by ws require()ing those two modules and they're not listed
// in our dependencies. Info on the reason for this is here:
// https://github.com/websockets/ws/blob/5d751fbd4c0ab3478a6de4194d4d06908bc8ac00/README.md#opt-in-for-performance-and-spec-compliance
//
// It appears to be safe to ignore these as they're being loaded in a try{} block
// and are optional.
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require("path");
module.exports = (env) => {
/**
* @type {import("webpack").Configuration}
*/
const config = {
devtool: "source-map",
entry: {
extension: "./src/extension/extension.ts",
debug: "./src/debug/debug_entry.ts",
},
// https://webpack.js.org/configuration/externals/
externals: {
vscode: "commonjs vscode",
},
module: {
rules: [{
exclude: /node_modules/,
test: /\.ts$/,
loader: "ts-loader",
}],
},
output: {
devtoolModuleFilenameTemplate: "../../[resource-path]",
libraryTarget: "commonjs2",
path: path.resolve(__dirname, "out/dist"),
},
optimization: {
minimize: false,
},
resolve: {
extensions: [".ts", ".js"],
},
target: "node",
};
if (env && env.instrumentation) {
config.module.rules.push({
enforce: "post",
exclude: /node_modules/,
test: /\.ts$/,
loader: "istanbul-instrumenter-loader",
});
}
return config;
};