mirror of
https://github.com/ziex-dev/ziex.git
synced 2026-07-20 02:29:36 -06:00
fix(js): only register devhook when running with devserver
Fixes: https://github.com/ziex-dev/ziex/issues/158
This commit is contained in:
parent
381b1cf0a4
commit
f4815c8bb1
@ -31,6 +31,9 @@ async function main() {
|
||||
entrypoints: [join(pkgDir, "src/index.ts"), join(pkgDir, "src/react/index.ts"), join(pkgDir, "src/wasm/index.ts"), join(pkgDir, "src/cloudflare/index.ts"), join(pkgDir, "src/aws-lambda/index.ts"), join(pkgDir, "src/vercel/index.ts")],
|
||||
outdir: pkgDistDir,
|
||||
// minify: true,
|
||||
define: {
|
||||
__DEV__: "true",
|
||||
}
|
||||
});
|
||||
|
||||
// Build standalone WASM init script (auto-initializes, for direct <script> usage)
|
||||
@ -38,8 +41,23 @@ async function main() {
|
||||
await Bun.build({
|
||||
entrypoints: [join(pkgDir, "src/wasm/init.ts")],
|
||||
outdir: join(pkgDistDir, "wasm"),
|
||||
minify: false,
|
||||
minify: true,
|
||||
naming: "[name].js",
|
||||
define: {
|
||||
__DEV__: "false",
|
||||
}
|
||||
});
|
||||
|
||||
// Build standalone WASM init script (auto-initializes, for direct <script> usage)
|
||||
console.log(`\x1b[33m📦 ${pkgName} - Building standalone dev wasm/init.dev.js...\x1b[0m`);
|
||||
await Bun.build({
|
||||
entrypoints: [join(pkgDir, "src/wasm/init.ts")],
|
||||
outdir: join(pkgDistDir, "wasm"),
|
||||
minify: false,
|
||||
naming: "[name].dev.js",
|
||||
define: {
|
||||
__DEV__: "true",
|
||||
}
|
||||
});
|
||||
|
||||
// Generate TypeScript declaration files
|
||||
|
||||
@ -761,15 +761,15 @@ export async function init(options: InitOptions = {}): Promise<{ source: WebAsse
|
||||
},
|
||||
};
|
||||
|
||||
// TODO: dev only and prebundle a dev and prod version before publishing
|
||||
// if (import.meta.env.DEV)
|
||||
registerDevReinit(normalizedOptions);
|
||||
if (typeof __DEV__ !== "undefined" && __DEV__) registerDevReinit(normalizedOptions);
|
||||
|
||||
return { source, bridge };
|
||||
}
|
||||
|
||||
// Global type declarations
|
||||
declare global {
|
||||
const __DEV__: boolean;
|
||||
|
||||
interface HTMLElement {
|
||||
__zx_ref?: number;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user