Skip to content

[BUG] The 'MODULE_NOT_FOUND' error in pnpm workspace #687

Open
@c-w-xiaohei

Description

@c-w-xiaohei

Describe the bug

I'm using pnpm workspace to build up my monorepo.
I found that 'MODULE_NOT_FOUND' errors of various packages raised up during running ‘next build’ after implementing the script 'opennextjs-cloudflare build'.
There's part of the logs:
Error: Cannot find module '@swc/helpers/_/_interop_require_default'
Require stack:

Steps to reproduce

1.Build up a pnpm workspace
2.Setup a Next project in a subpackage.
3.Run 'opennextjs-cloudflare build' in the subpackage
4.Run 'next build'

Expected behavior

Build successfully

@opennextjs/cloudflare version

1.0.4

Wrangler version

4.17.0

next info output

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home China
  Available memory (MB): 16017
  Available CPU cores: 12
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: N/A
  pnpm: 8.15.4
Relevant Packages:
  next: 15.2.4 // There is a newer version (15.3.2) available, upgrade recommended!
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

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