blitz-js / blitz-js/next-superjson-plugin

Next 15 does not work if there is an instrumentation.ts file

Open
#115 5 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
216
Forks
13
PR merge metrics
No merged PRs in 30d

Description

### Verify Next.js canary release

- [x] I verified that the issue exists in the latest Next.js canary release

### Describe the bug

The server crashes on startup while trying to compile the `instrumentation.ts` file.

```
○ Compiling /instrumentation ...
⨯ ./instrumentation.ts
Error: × failed to invoke plugin on 'Some("/project/workspace/instrumentation.ts")'
[Error: An error occurred while loading instrumentation hook: Cannot find module '/project/workspace/.next/server/instrumentation'
Require stack:
- /project/workspace/node_modules/.pnpm/next@15.3.0-canary.24_react-dom@19.0.0_react@19.0.0/node_modules/next/dist/server/dev/next-dev-server.js
- /project/workspace/node_modules/.pnpm/next@15.3.0-canary.24_react-dom@19.0.0_react@19.0.0/node_modules/next/dist/server/next.js
- /project/workspace/node_modules/.pnpm/next@15.3.0-canary.24_react-dom@19.0.0_react@19.0.0/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
```

### Expected behavior

The server to startup normally and the superjson plugin to function.

### Reproduction link

https://codesandbox.io/p/devbox/festive-marco-874kzf?workspaceId=ws_UDh5PPYTfH5dS4grc4QC5V

### Version

0.6.3

### Config

```javascript
{
reactStrictMode: true,
experimental: {
swcPlugins: [["next-superjson-plugin", {}]],
},
}
```

### Additional context

If you delete the `instrumentation.ts` file OR the superjson plugin line from next config, everything works normally.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.