eeg_nest/esbuild.js
2023-05-17 13:04:11 -05:00

61 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");
/**
* 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
*/
(async () => {
const ctx = await context({
platform: "browser",
entryPoints: [
"src/views/hydration.ts",
],
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...");
})();