eeg_nest/esbuild-prod.js
2023-06-12 22:08:21 -05:00

55 lines
1.3 KiB
JavaScript

const { build, context } = require("esbuild");
const { solidPlugin } = require("esbuild-plugin-solid");
const path = require("path");
const fs = require("fs");
const { glob } = require("glob");
const buildHydration = (path) => {
build({
platform: "browser",
entryPoints: [
path,
],
bundle: true,
minify: true,
sourcemap: false,
logLevel: "info",
plugins: [
solidPlugin({
solid: {
generate: "dom",
hydratable: true,
},
})
],
outdir: "static",
format: "cjs",
});
}
(async() => {
const files = await glob("dist/**/*.jsx");
build({
platform: "node",
entryPoints: files,
bundle: false,
minify: true,
sourcemap: false,
logLevel: "info",
plugins: [solidPlugin({
solid: {
generate: "ssr",
hydratable: true,
},
})],
outdir: "dist",
outbase: "dist",
format: "cjs",
});
})();
buildHydration("src/views/hydration.ts");
buildHydration("src/views/hydration/hydration_aulavirtual.ts");
buildHydration("src/views/hydration/hydration_batch_mode.ts");