forked from manuth/MarkdownConverter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
104 lines (97 loc) · 2.92 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
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
import { dirname, join, parse, relative, resolve } from "path";
import { Configuration, WatchIgnorePlugin } from "webpack";
export = (env: any, argv: any) =>
{
let sourceRoot = join(__dirname, "src");
let externalModules: string[] = [
"mocha",
"vscode"
];
let entryPoints: string[] = [
join(sourceRoot, "index.ts"),
join(sourceRoot, "test", "runTests.ts"),
join(sourceRoot, "test", "index.ts"),
join(sourceRoot, "test", "essentials.test.ts"),
join(sourceRoot, "test", "common.test.ts"),
join(sourceRoot, "test", "single-file.test.ts"),
join(sourceRoot, "test", "single-folder.test.ts"),
join(sourceRoot, "test", "workspace.test.ts")
];
let externals: Record<string, string> = {};
let entry: Record<string, string> = {};
for (let externalModule of externalModules)
{
externals[externalModule] = `commonjs ${externalModule}`;
}
for (let entryPoint of entryPoints)
{
entry[join(relative(sourceRoot, dirname(entryPoint)), parse(entryPoint).name)] = entryPoint;
}
return {
target: "node",
entry,
output: {
path: resolve(__dirname, "lib"),
filename: "[name].js",
libraryTarget: "commonjs2",
devtoolFallbackModuleFilenameTemplate: "../[resource-path]",
hashFunction: "xxhash64"
},
devtool: "source-map",
externals,
resolve: {
extensions: [
".ts",
".js",
".json"
],
mainFields: [
"main",
"module"
]
},
plugins: [
new WatchIgnorePlugin(
{
paths: [
/\.d\.ts$/
]
})
],
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader",
options: {
projectReferences: true,
compilerOptions: {
outDir: resolve(__dirname, "lib", "temp")
}
}
}
]
},
{
test: /\.json$/i,
exclude: /node_modules/,
loader: "json5-loader",
type: "javascript/auto",
options: {
esModule: false
}
}
]
},
node: {
__dirname: false,
__filename: false
},
stats: {
warnings: false
}
} as Configuration;
};