eeg_nest/esbuild.js

61 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-05-07 00:14:11 +00:00
const { build, context } = require("esbuild");
const { solidPlugin } = require("esbuild-plugin-solid");
2023-05-06 11:57:46 +00:00
const path = require("path");
const fs = require("fs");
2023-05-07 00:14:11 +00:00
const { glob } = require("glob");
2023-05-06 11:57:46 +00:00
2023-05-17 18:04:11 +00:00
/**
* Compile JSX files
*/
2023-05-07 00:14:11 +00:00
(async() => {
const files = await glob("dist/**/*.jsx");
console.log(files);
2023-05-07 00:14:11 +00:00
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",
2023-05-07 00:14:11 +00:00
format: "cjs",
});
await ctx.watch();
2023-05-17 18:04:11 +00:00
console.log("Watching Solid JSX...");
2023-05-07 00:14:11 +00:00
})();
2023-05-17 18:04:11 +00:00
/**
* Generate hydration script
*/
(async () => {
const ctx = await context({
platform: "browser",
entryPoints: [
"src/views/hydration.ts",
],
bundle: true,
minify: false,
logLevel: "info",
plugins: [
solidPlugin({
2023-05-07 00:06:11 +00:00
solid: {
2023-05-17 18:04:11 +00:00
generate: "dom",
2023-05-07 00:06:11 +00:00
hydratable: true,
},
2023-05-17 18:04:11 +00:00
})
],
outdir: "static",
format: "cjs",
2023-05-07 00:06:11 +00:00
});
2023-05-07 00:14:11 +00:00
2023-05-17 18:04:11 +00:00
await ctx.watch();
console.log("Watching hydration script...");
})();