-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.mjs
45 lines (42 loc) · 1.26 KB
/
build.mjs
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
import esbuild from "esbuild";
import extensibilityMap from "@neos-project/neos-ui-extensibility/extensibilityMap.json" assert { type: "json" };
import stylexPlugin from "@stylexjs/esbuild-plugin";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/** @type {import("esbuild").BuildOptions} */
const options = {
logLevel: "info",
bundle: true,
minify: true,
sourcemap: true,
target: "es2020",
format: "iife",
legalComments: "none",
entryPoints: {
Plugin: "Resources/Private/Editor/manifest.ts",
},
loader: {
".js": "tsx",
},
outdir: "Resources/Public",
alias: extensibilityMap,
plugins: [
stylexPlugin({
dev: false,
generatedCSSFileName: path.resolve(__dirname, "Resources/Public/Plugin.css"),
stylexImports: ["@stylexjs/stylex"],
treeshakeCompensation: true,
unstable_moduleResolution: {
type: "commonJS",
rootDir: __dirname,
},
}),
],
};
// eslint-disable-next-line no-undef
if (process.argv.includes("--watch")) {
esbuild.context(options).then((ctx) => ctx.watch());
} else {
esbuild.build(options);
}