Skip to content

Commit d279a84

Browse files
vicbpetebacondarwin
andcommitted
refactor: cleanup
Co-authored-by: Pete Bacon Darwin <pbacondarwin@cloudflare.com>
1 parent baa634c commit d279a84

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

packages/cloudflare/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ const config: OpenNextConfig = {
6666
export default config;
6767
```
6868

69-
## Know issues
69+
## Known issues
7070

7171
- Next cache is not supported in the experimental branch yet
7272
- `▲ [WARNING] Suspicious assignment to defined constant "process.env.NODE_ENV" [assign-to-define]` can safely be ignored
73-
- You should test with cache disabled in the developper tools
73+
- You should test with cache disabled in the developer tools
7474
- Maybe more, still experimental...
7575

7676
## Local development

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export async function bundleServer(config: Config, openNextOptions: BuildOptions
3434

3535
const nextConfigStr =
3636
fs
37-
.readFileSync(path.join(config.paths.output.standaloneApp, "/server.js"), "utf8")
37+
.readFileSync(path.join(config.paths.output.standaloneApp, "server.js"), "utf8")
3838
?.match(/const nextConfig = ({.+?})\n/)?.[1] ?? {};
3939

4040
console.log(`\x1b[35m⚙️ Bundling the OpenNext server...\n\x1b[0m`);
@@ -87,10 +87,11 @@ export async function bundleServer(config: Config, openNextOptions: BuildOptions
8787
// We need to set platform to node so that esbuild doesn't complain about the node imports
8888
platform: "node",
8989
banner: {
90-
// `__dirname` is used by unbundled js files (which don't inherit the `__dirname` present in the `define` field)
91-
// so we also need to set it on the global scope
92-
// Note: this was hit in the `next/dist/compiled/@opentelemetry/api` module
9390
js: `
91+
// __dirname is used by unbundled js files (which don't inherit the __dirname present in the define field)
92+
// so we also need to set it on the global scope
93+
// Note: this was hit in the next/dist/compiled/@opentelemetry/api module
94+
9495
globalThis.__dirname ??= "";
9596
9697
// Do not crash on cache not supported

packages/cloudflare/src/cli/build/open-next/createServerBundle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ function addMonorepoEntrypoint(outputPath: string, packagePath: string) {
274274
// the root of the bundle. We will create a dummy `index.mjs`
275275
// that re-exports the real handler.
276276

277+
// TOOD: use helper
277278
// Always use posix path for import path
278279
const packagePosixPath = packagePath.split(path.sep).join(path.posix.sep);
279280
fs.writeFileSync(path.join(outputPath, "index.mjs"), `export * from "./${packagePosixPath}/index.mjs";`);

0 commit comments

Comments
 (0)