-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.mjs
46 lines (40 loc) · 1.2 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
46
import esbuild from "esbuild";
import extensibilityMap from "@neos-project/neos-ui-extensibility/extensibilityMap.json" assert { type: "json" };
import { cssModules } from "esbuild-plugin-lightningcss-modules";
const watch = process.argv.includes("--watch");
/** @type {import("esbuild").BuildOptions} */
const globalOptions = {
logLevel: "info",
bundle: true,
minify: !watch,
sourcemap: watch,
target: "es2020",
format: "iife",
legalComments: "none",
}
const editorOptions = {
...globalOptions,
entryPoints: { Plugin: "Resources/Private/Editor/manifest.js" },
outdir: "Resources/Public/Editor",
alias: extensibilityMap,
loader: { '.js': 'jsx' },
plugins: [
cssModules({
targets: {
chrome: 80, // aligns somewhat to es2020
},
}),
],
};
const backendOptions = {
...globalOptions,
entryPoints: ["Resources/Private/Assets/Backend.js"],
outfile: "Resources/Public/Scripts/Backend.js",
}
if (watch) {
esbuild.context(editorOptions).then((ctx) => ctx.watch());
esbuild.context(backendOptions).then((ctx) => ctx.watch());
} else {
esbuild.build(editorOptions);
esbuild.build(backendOptions);
}