Skip to content

[BUG] Error during bundling. # patchWranglerDeps . ts-morph  #245

@BrunoCode

Description

@BrunoCode

Describe the bug

When running npm run build:worker (which runs opennextjs-cloudflare), it fails to build from ts-morph issue related to TS errors. This is when trying to use open-nextjs in the default nextjs project.

A peek at the error:

# patchWranglerDeps
/Users/bruno/workspace/examply/node_modules/ts-morph/dist/ts-morph.js:2377
            throw new ManipulationError(sourceFile.getFilePath(), oldFileText, newFileText, message);
                  ^

ManipulationError: Manipulation error: A syntax error was inserted.

file.js:16:8 - error TS8010: Type annotations can only be used in TypeScript files.

Full error logs attached as a text file.

Terminal_Saved_Output.txt

Steps to reproduce

  1. git clone https://github.com/BrunoCode/open-nextjs-ts-morph-issue.git
  2. npm install
  3. npm run build:worker

Expected behavior

Builds my worker correctly, and successfully.

@opennextjs/cloudflare version

0.3.5

Wrangler version

3.101.0

next info output

> next info

/bin/sh: yarn: command not found
/bin/sh: pnpm: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103
  Available memory (MB): 8192
  Available CPU cores: 8
Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.1.4 // Latest available version is detected (15.1.4).
  eslint-config-next: 15.1.4
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

Additional context

App created using npx create-next-app@latest. Followed open-nextjs instructions to use open-nextjs.

My answers were:

✔ Would you like to use TypeScript? Yes
✔ Would you like to use ESLint? Yes
✔ Would you like to use Tailwind CSS? Yes
✔ Would you like your code inside a src/ directory? Yes
✔ Would you like to use App Router? (recommended) Yes
✔ Would you like to use Turbopack for next dev? No
✔ Would you like to customize the import alias (@/* by default) No

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions