-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.config.js
More file actions
54 lines (49 loc) · 1.66 KB
/
Copy pathesbuild.config.js
File metadata and controls
54 lines (49 loc) · 1.66 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
// esbuild.config.js
const esbuild = require("esbuild");
// Define common build options
const buildOptions = {
entryPoints: ["./src/ConcurrentCallbackQueue.js"], // Path to the entry file of your library
bundle: true, // Bundle all dependencies into the output file
sourcemap: true, // Generate source maps for easier debugging
target: "es2015", // Target ECMAScript version
legalComments: "linked", // Preserve comments with a URL to the source code
};
// Build for CommonJS (CJS)
esbuild
.build({
...buildOptions,
format: "cjs", // CommonJS format
outfile: "./dist/ConcurrentCallbackQueue.cjs.js", // Output file
platform: "node", // Platform target
})
.catch(() => process.exit(1));
// Build for ES Module (ESM)
esbuild
.build({
...buildOptions,
format: "esm", // ES Module format
outfile: "./dist/ConcurrentCallbackQueue.esm.js", // Output file
platform: "browser", // Platform target
})
.catch(() => process.exit(1));
// Build for IIFE (unminified)
esbuild
.build({
...buildOptions,
format: "iife", // IIFE format
globalName: "ConcurrentCallbackQueue", // Global variable name for IIFE build
outfile: "./dist/ConcurrentCallbackQueue.iife.js", // Output file
platform: "browser", // Platform target
})
.catch(() => process.exit(1));
// Build for IIFE (minified)
esbuild
.build({
...buildOptions,
format: "iife", // IIFE format
globalName: "ConcurrentCallbackQueue", // Global variable name for IIFE build
outfile: "./dist/ConcurrentCallbackQueue.iife.min.js", // Output file
minify: true, // Minify the output
platform: "browser", // Platform target
})
.catch(() => process.exit(1));