Refactor artifacts to use relative directory for build step and retrieval
This commit is contained in:
+7
-6
@@ -9,8 +9,8 @@ import serverPostBuildFn from "../server-post-build-fn";
|
||||
import isDevelopment from "../../../utils/is-development";
|
||||
import { existsSync } from "fs";
|
||||
import grabDirNames from "../../../utils/grab-dir-names";
|
||||
import watcherEsbuildCTX from "../watcher-esbuild-ctx";
|
||||
const { BUNX_BUNDLER_ERROR_EXIT_FILE } = grabDirNames();
|
||||
import grabRelativePath from "../../../utils/grab-relative-path";
|
||||
const { BUNX_BUNDLER_ERROR_EXIT_FILE, ROOT_DIR } = grabDirNames();
|
||||
class NotFoundError extends Error {
|
||||
status = 404;
|
||||
constructor(message) {
|
||||
@@ -51,7 +51,8 @@ export default async function grabPageComponent(params) {
|
||||
// log.error(errMsg);
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
let bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[file_path];
|
||||
const relative_file_path = grabRelativePath(file_path);
|
||||
let bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[relative_file_path];
|
||||
if (!bundledMap?.path) {
|
||||
if (does_error_file_exist) {
|
||||
throw new Error(`Application Error. Please Check your components. ${match?.filePath} likely exists but has no exported module.`);
|
||||
@@ -60,10 +61,10 @@ export default async function grabPageComponent(params) {
|
||||
const MAX_RETRIES = 2;
|
||||
while (retries < MAX_RETRIES) {
|
||||
await fullRebuild({
|
||||
msg: `Retrying Bundle map for file \`${file_path}\``,
|
||||
msg: `Retrying Bundle map for file \`${relative_file_path}\``,
|
||||
});
|
||||
await Bun.sleep(1000);
|
||||
bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[file_path];
|
||||
bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[relative_file_path];
|
||||
if (bundledMap?.path)
|
||||
break;
|
||||
}
|
||||
@@ -74,7 +75,7 @@ export default async function grabPageComponent(params) {
|
||||
}
|
||||
}
|
||||
if (req && !is_hydration) {
|
||||
global.BUNEXT_BUNDLER_CTX_MAP[file_path].req_url = req.url;
|
||||
global.BUNEXT_BUNDLER_CTX_MAP[relative_file_path].req_url = req.url;
|
||||
}
|
||||
if (debug) {
|
||||
log.info(`bundledMap:`, bundledMap);
|
||||
|
||||
Reference in New Issue
Block a user