@opennextjs/cloudflare 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -42,7 +42,7 @@ const optionalDependencies = [
|
|
|
42
42
|
*/
|
|
43
43
|
export async function bundleServer(buildOpts) {
|
|
44
44
|
patches.copyPackageCliFiles(packageDistDir, buildOpts);
|
|
45
|
-
const { appPath, outputDir, monorepoRoot } = buildOpts;
|
|
45
|
+
const { appPath, outputDir, monorepoRoot, debug } = buildOpts;
|
|
46
46
|
const baseManifestPath = path.join(outputDir, "server-functions/default", getPackagePath(buildOpts), ".next");
|
|
47
47
|
const serverFiles = path.join(baseManifestPath, "required-server-files.json");
|
|
48
48
|
const nextConfig = JSON.parse(fs.readFileSync(serverFiles, "utf-8")).config;
|
|
@@ -60,7 +60,11 @@ export async function bundleServer(buildOpts) {
|
|
|
60
60
|
outfile: openNextServerBundle,
|
|
61
61
|
format: "esm",
|
|
62
62
|
target: "esnext",
|
|
63
|
-
|
|
63
|
+
// Minify code as much as possible but stay safe by not renaming identifiers
|
|
64
|
+
minifyWhitespace: !debug,
|
|
65
|
+
minifyIdentifiers: false,
|
|
66
|
+
minifySyntax: !debug,
|
|
67
|
+
legalComments: "none",
|
|
64
68
|
metafile: true,
|
|
65
69
|
// Next traces files using the default conditions from `nft` (`node`, `require`, `import` and `default`)
|
|
66
70
|
//
|
|
@@ -142,7 +146,9 @@ export async function bundleServer(buildOpts) {
|
|
|
142
146
|
*/
|
|
143
147
|
export async function updateWorkerBundledCode(workerOutputFile) {
|
|
144
148
|
const code = await readFile(workerOutputFile, "utf8");
|
|
145
|
-
const patchedCode = await patchCodeWithValidations(code, [
|
|
149
|
+
const patchedCode = await patchCodeWithValidations(code, [
|
|
150
|
+
["require", patches.patchRequire, { isOptional: true }],
|
|
151
|
+
]);
|
|
146
152
|
await writeFile(workerOutputFile, patchedCode);
|
|
147
153
|
}
|
|
148
154
|
/**
|
|
@@ -10,7 +10,6 @@ export function patchResolveCache(updater, buildOpts) {
|
|
|
10
10
|
const packagePath = getPackagePath(buildOpts);
|
|
11
11
|
const outputPath = path.join(outputDir, "server-functions/default");
|
|
12
12
|
const indexPath = path.relative(buildOpts.appBuildOutputPath, path.join(outputPath, packagePath, `index.mjs`));
|
|
13
|
-
console.error({ index: indexPath });
|
|
14
13
|
return updater.updateContent("patch-resolve-cache", [
|
|
15
14
|
{
|
|
16
15
|
field: {
|