Skip to content

[BUG] 0.3 Introduces CJS bug #198

@wesbos

Description

@wesbos

Describe the bug

just updated to 0.3 and it seems one of the patches introduced a bug while importing a method on glob:

.../node_modules/.pnpm/@opennextjs+cloudflare@0.3.0_rimraf@3.0.2_wrangler@3.96.0/node_modules/@opennextjs/cloudflare/dist/cli/build/patches/to-investigate/inline-eval-manifest.js:2

import { globSync } from "glob";
         ^^^^^^^^
SyntaxError: Named export 'globSync' not found. The requested module 'glob' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'glob';
const { globSync } = pkg;

tested on node v23.4.0 and 22.11.0

Steps to reproduce

happens when I run pnpm run preview:worker

Here are my scripts:

    "build:worker": "opennextjs-cloudflare",
    "dev:worker": "wrangler dev --port 8771",
    "preview:worker": "pnpm run build:worker && pnpm run dev:worker",
    "deploy:worker": "pnpm run build:worker && wrangler deploy",

Expected behavior

it does not error

@opennextjs/cloudflare version

0.3.0

Wrangler version

3.96.0

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 65536
  Available CPU cores: 10
Binaries:
  Node: 23.4.0
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 9.10.0
Relevant Packages:
  next: 15.1.1 // There is a newer version (15.1.2) available, upgrade recommended! 
  eslint-config-next: 15.1.1
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.1.2) available, upgrade recommended! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions