const { context } = require("esbuild"); const { solidPlugin } = require("esbuild-plugin-solid"); const { glob } = require("glob"); const genHydration = (path) => async () => { const ctx = await context({ platform: "browser", entryPoints: [ path, ], bundle: true, minify: false, logLevel: "info", plugins: [ solidPlugin({ solid: { generate: "dom", hydratable: true, }, }) ], outdir: "static", format: "cjs", }); await ctx.watch(); console.log("Watching hydration script..."); }; /** * Compile JSX files */ (async() => { const files = await glob("dist/**/*.jsx"); console.log(files); const ctx = await context({ platform: "node", entryPoints: files, bundle: false, minify: false, logLevel: "info", plugins: [solidPlugin({ solid: { generate: "ssr", hydratable: true, }, })], outdir: "dist", outbase: "dist", format: "cjs", }); await ctx.watch(); console.log("Watching Solid JSX..."); })(); /** * Generate hydration script */ (genHydration("src/views/hydration.ts"))(); (genHydration("src/views/hydration/hydration_aulavirtual.ts"))(); (genHydration("src/views/hydration/hydration_batch_mode.ts"))();