-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathesbuild.js
More file actions
52 lines (49 loc) · 1.38 KB
/
esbuild.js
File metadata and controls
52 lines (49 loc) · 1.38 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
/*eslint-disable @typescript-eslint/no-var-requires */
const pkg = require("./package.json");
const { NodeGlobalsPolyfillPlugin } = require("@esbuild-plugins/node-globals-polyfill");
const { NodeModulesPolyfillPlugin } = require("@esbuild-plugins/node-modules-polyfill");
const esbuild = require("esbuild");
const GlobalsPlugin = require("esbuild-plugin-globals");
esbuild.build({
entryPoints: ["src/index.ts"],
bundle: true,
outfile: pkg.browser,
globalName: "TournamentAssistantClient",
platform: "browser",
define: {
global: "window"
},
target: ["chrome60", "edge18", "firefox60", "safari11"],
plugins: [
GlobalsPlugin({
ws: "WebSocket",
}),
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin(),
],
});
esbuild.build({
entryPoints: ["src/index.ts"],
bundle: true,
outfile: pkg.browser.replace("min", "module"),
globalName: "TournamentAssistantClient",
platform: "browser",
define: {
global: "window"
},
format: "esm",
target: ["chrome60", "edge18", "firefox60", "safari11"],
plugins: [
GlobalsPlugin({
ws: "WebSocket",
}),
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin(),
],
});