-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
53 lines (48 loc) · 982 Bytes
/
build.js
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
import esbuild from "esbuild";
import fs from "fs";
fs.copyFileSync("src/style.css", "dist/style.css");
fs.copyFileSync("src/index.d.ts", "dist/index.d.ts"); // 이 줄이 타입 선언 파일을 복사합니다.
const commonConfig = {
bundle: true,
platform: "browser",
target: "esnext",
minify: true,
sourcemap: true,
metafile: true,
};
await esbuild.build({
...commonConfig,
entryPoints: ["src/cdn.ts"],
outfile: "dist/index.min.js",
format: "iife",
globalName: "EyeOnIt",
loader: {
".css": "text",
},
banner: {
js: "(() => {",
},
footer: {
js: "})();",
},
});
await esbuild.build({
...commonConfig,
entryPoints: ["src/index.ts"],
outfile: "dist/index.mjs",
format: "esm",
loader: {
".css": "copy",
},
external: ["*.css"],
});
await esbuild.build({
...commonConfig,
entryPoints: ["src/index.ts"],
outfile: "dist/index.js",
format: "cjs",
loader: {
".css": "copy",
},
external: ["*.css"],
});