Refactor Bundler. Fix bugs.
This commit is contained in:
@@ -52,8 +52,6 @@ export default async function watcherEsbuildCTX() {
|
||||
if (global.RECOMPILING) return;
|
||||
global.RECOMPILING = true;
|
||||
|
||||
log.info(`Rebuilding CTX ...`);
|
||||
|
||||
await global.BUNDLER_CTX?.rebuild();
|
||||
|
||||
if (filename.match(/(404|500)\.tsx?/)) {
|
||||
@@ -107,28 +105,21 @@ async function fullRebuild(params?: { msg?: string }) {
|
||||
log.watch(msg);
|
||||
}
|
||||
|
||||
log.info(`Reloading Router ...`);
|
||||
|
||||
global.ROUTER.reload();
|
||||
|
||||
log.info(`Disposing Bundler CTX ...`);
|
||||
await global.BUNDLER_CTX?.dispose();
|
||||
global.BUNDLER_CTX = undefined;
|
||||
|
||||
global.BUNDLER_CTX_MAP = {};
|
||||
|
||||
log.info(`Rebuilding Modules ...`);
|
||||
allPagesESBuildContextBundler({
|
||||
post_build_fn: serverPostBuildFn,
|
||||
});
|
||||
} catch (error: any) {
|
||||
log.error(error);
|
||||
} finally {
|
||||
global.RECOMPILING = false;
|
||||
}
|
||||
|
||||
if (global.PAGES_SRC_WATCHER) {
|
||||
log.info(`Restarting watcher ...`);
|
||||
global.PAGES_SRC_WATCHER.close();
|
||||
watcherEsbuildCTX();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user