Update
This commit is contained in:
parent
19d0ceb7db
commit
cefcad9b76
@ -23,6 +23,12 @@ export default function () {
|
|||||||
|
|
||||||
allPagesBundler({
|
allPagesBundler({
|
||||||
exit_after_first_build: true,
|
exit_after_first_build: true,
|
||||||
|
// async post_build_fn({ artifacts }) {
|
||||||
|
// writeFileSync(
|
||||||
|
// HYDRATION_DST_DIR_MAP_JSON_FILE,
|
||||||
|
// JSON.stringify(artifacts),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import type { BundlerCTXMap } from "../../types";
|
|||||||
import { execSync } from "child_process";
|
import { execSync } from "child_process";
|
||||||
import grabConstants from "../../utils/grab-constants";
|
import grabConstants from "../../utils/grab-constants";
|
||||||
|
|
||||||
const { HYDRATION_DST_DIR, PAGES_DIR } = grabDirNames();
|
const { HYDRATION_DST_DIR, PAGES_DIR, HYDRATION_DST_DIR_MAP_JSON_FILE } =
|
||||||
|
grabDirNames();
|
||||||
|
|
||||||
const tailwindPlugin: esbuild.Plugin = {
|
const tailwindPlugin: esbuild.Plugin = {
|
||||||
name: "tailwindcss",
|
name: "tailwindcss",
|
||||||
@ -151,11 +152,16 @@ export default async function allPagesBundler(params?: Params) {
|
|||||||
|
|
||||||
console.timeEnd("build");
|
console.timeEnd("build");
|
||||||
|
|
||||||
|
writeFileSync(
|
||||||
|
HYDRATION_DST_DIR_MAP_JSON_FILE,
|
||||||
|
JSON.stringify(artifacts),
|
||||||
|
);
|
||||||
|
|
||||||
if (params?.exit_after_first_build) {
|
if (params?.exit_after_first_build) {
|
||||||
console.log(
|
// console.log(
|
||||||
"global.BUNDLER_CTX_MAP",
|
// "global.BUNDLER_CTX_MAP",
|
||||||
global.BUNDLER_CTX_MAP,
|
// global.BUNDLER_CTX_MAP,
|
||||||
);
|
// );
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,6 +4,12 @@ import allPagesBundler from "../bundler/all-pages-bundler";
|
|||||||
import serverParamsGen from "./server-params-gen";
|
import serverParamsGen from "./server-params-gen";
|
||||||
import watcher from "./watcher";
|
import watcher from "./watcher";
|
||||||
import serverPostBuildFn from "./server-post-build-fn";
|
import serverPostBuildFn from "./server-post-build-fn";
|
||||||
|
import grabDirNames from "../../utils/grab-dir-names";
|
||||||
|
import EJSON from "../../utils/ejson";
|
||||||
|
import { readFileSync } from "fs";
|
||||||
|
import type { BundlerCTXMap } from "../../types";
|
||||||
|
|
||||||
|
const { HYDRATION_DST_DIR_MAP_JSON_FILE } = grabDirNames();
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
dev?: boolean;
|
dev?: boolean;
|
||||||
@ -21,6 +27,14 @@ export default async function startServer(params?: Params) {
|
|||||||
});
|
});
|
||||||
watcher();
|
watcher();
|
||||||
} else {
|
} else {
|
||||||
|
const artifacts = EJSON.parse(
|
||||||
|
readFileSync(HYDRATION_DST_DIR_MAP_JSON_FILE, "utf-8"),
|
||||||
|
) as BundlerCTXMap[] | undefined;
|
||||||
|
if (!artifacts?.[0]) {
|
||||||
|
console.error(`Please build first.`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
global.BUNDLER_CTX_MAP = artifacts;
|
||||||
global.IS_FIRST_BUNDLE_READY = true;
|
global.IS_FIRST_BUNDLE_READY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user