-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.js
49 lines (47 loc) · 1.28 KB
/
esbuild.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
import * as esbuild from "esbuild";
import copyStaticFiles from "esbuild-copy-static-files";
import * as fsExtra from "fs-extra";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import copyFilePlugin from "./esbuild-helper/copy-file-plugin.js";
fsExtra.emptyDirSync("./dist");
esbuild.build({
entryPoints: ["./js/editor.js"],
outdir: "dist/js",
bundle: true,
minify: true,
sourcemap: true, // Source map needed for sentry to work
mainFields: ["module", "main"],
plugins: [
copyFilePlugin("./manifest.json", "./dist/manifest.json"),
copyFilePlugin("./sw.js", "./dist/sw.js"),
copyStaticFiles({
src: "./css",
dest: "dist/css",
dereference: true,
errorOnExist: false,
preserveTimestamps: false,
recursive: true,
}),
copyStaticFiles({
src: "./assets",
dest: "dist/assets",
dereference: true,
errorOnExist: false,
preserveTimestamps: false,
recursive: true,
}),
copyStaticFiles({
src: "./html",
dest: "dist/",
dereference: true,
errorOnExist: false,
preserveTimestamps: false,
recursive: true,
}),
sentryEsbuildPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "typetocalculate",
project: "javascript",
}),
],
});