forked from perry-mitchell/webdav-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.cjs
92 lines (80 loc) · 2.21 KB
/
webpack.config.cjs
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
const path = require("node:path");
const { DefinePlugin } = require("webpack");
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const DIST = path.resolve(__dirname, "./dist/web");
const smp = new SpeedMeasurePlugin();
module.exports = smp.wrap({
entry: path.resolve(__dirname, "./source/index.ts"),
experiments: {
outputModule: true
},
externals: [],
externalsType: "module",
module: {
rules: [
{
test: /\.[jt]s$/,
loader: "babel-loader",
options: {
presets: [
["@babel/preset-env", {
targets: [
"> 0.25%, not dead",
"maintained node versions"
]
}],
"@babel/preset-typescript"
],
plugins: [
"babel-plugin-transform-async-to-promises"
]
},
resolve: {
fullySpecified: false
}
}
]
},
node: false,
output: {
filename: "index.js",
path: DIST,
environment: {
module: true
},
library: {
type: "module"
}
},
plugins: [
new DefinePlugin({
WEB: "true"
})
],
resolve: {
alias: {
"he": path.resolve(__dirname, "./util/he.stub.ts"),
"http": path.resolve(__dirname, "./util/http.stub.ts"),
"node-fetch": path.resolve(__dirname, "./util/node-fetch.stub.ts")
},
extensions: [".js"],
fallback: {
buffer: false,
crypto: false,
dns: false,
fs: false,
http: false,
https: false,
net: false,
path: false,
stream: false,
util: false
},
plugins: [
// Handle .ts => .js resolution
new ResolveTypeScriptPlugin()
]
},
target: "web"
});