fix
This commit is contained in:
parent
cc3f6ecf07
commit
43484766e4
|
|
@ -31,9 +31,7 @@ export const initFrontEnd = async (
|
||||||
} else {
|
} else {
|
||||||
if (force) {
|
if (force) {
|
||||||
try {
|
try {
|
||||||
existing.watch.close();
|
|
||||||
await existing.ctx.dispose();
|
await existing.ctx.dispose();
|
||||||
delete code.internal.frontend[id_site];
|
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
} else {
|
} else {
|
||||||
if (existing.ctx) {
|
if (existing.ctx) {
|
||||||
|
|
@ -71,10 +69,14 @@ export const initFrontEnd = async (
|
||||||
};
|
};
|
||||||
|
|
||||||
code.internal.frontend[id_site] = {
|
code.internal.frontend[id_site] = {
|
||||||
|
...(code.internal.frontend[id_site] || {}),
|
||||||
ctx: await initBuildCtx({ id_site, root }),
|
ctx: await initBuildCtx({ id_site, root }),
|
||||||
timeout: null,
|
timeout: null,
|
||||||
rebuilding: false,
|
rebuilding: false,
|
||||||
watch: watch(
|
};
|
||||||
|
|
||||||
|
if (!code.internal.frontend[id_site].watch) {
|
||||||
|
code.internal.frontend[id_site].watch = watch(
|
||||||
dir.data(root),
|
dir.data(root),
|
||||||
{
|
{
|
||||||
recursive: true,
|
recursive: true,
|
||||||
|
|
@ -120,8 +122,8 @@ export const initFrontEnd = async (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
);
|
||||||
};
|
}
|
||||||
const fe = code.internal.frontend[id_site];
|
const fe = code.internal.frontend[id_site];
|
||||||
fe.rebuilding = true;
|
fe.rebuilding = true;
|
||||||
try {
|
try {
|
||||||
|
|
@ -133,7 +135,6 @@ export const initFrontEnd = async (
|
||||||
fe.rebuilding = false;
|
fe.rebuilding = false;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error("Error building front end", id_site);
|
console.error("Error building front end", id_site);
|
||||||
delete code.internal.frontend[id_site];
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export const codeInternal = {
|
||||||
{
|
{
|
||||||
ctx: BuildContext;
|
ctx: BuildContext;
|
||||||
timeout: any;
|
timeout: any;
|
||||||
watch: FSWatcher;
|
watch?: FSWatcher;
|
||||||
rebuilding: boolean;
|
rebuilding: boolean;
|
||||||
npm?: Promise<void>;
|
npm?: Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue