forked from hediet/vscode-debug-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
65 lines (61 loc) · 1.42 KB
/
Copy pathwebpack.config.ts
File metadata and controls
65 lines (61 loc) · 1.42 KB
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
import * as webpack from "webpack";
import path = require("path");
import { CleanWebpackPlugin } from "clean-webpack-plugin";
import CopyPlugin = require("copy-webpack-plugin");
import { readFileSync } from "fs";
const r = (file: string) => path.resolve(__dirname, file);
module.exports = {
target: "node",
entry: r("./src/extension"),
output: {
path: r("./dist"),
filename: "extension.js",
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]",
},
devtool: "source-map",
externals: {
vscode: "commonjs vscode",
"@hediet/debug-visualizer-data-extraction":
"@hediet/debug-visualizer-data-extraction",
"debug-visualizer-webview": "debug-visualizer-webview",
fsevents: "require('fsevents')"
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader",
},
],
},
],
},
node: {
__dirname: false,
},
plugins: [
new CleanWebpackPlugin(),
includeDependency(r("../data-extraction/")),
includeDependency(r("../webview/")),
],
} as webpack.Configuration;
function includeDependency(location: string) {
const content = readFileSync(path.join(location, "package.json"), {
encoding: "utf8",
});
const pkgName = JSON.parse(content).name;
return new CopyPlugin([
{
from: location,
to: r(`./dist/node_modules/${pkgName}`),
ignore: ["**/node_modules/**/*"],
},
]);
}