-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Open
Labels
InstrumentationRelated to Next.js Instrumentation.Related to Next.js Instrumentation.bugIssue was opened via the bug report template.Issue was opened via the bug report template.
Description
Link to the code that reproduces this issue
https://github.com/bugs-report/nextjs-issue-64471
To Reproduce
First, install a node-binding package, like the @napi-rs/tar
, which provides the rust bindings and .node
bytecode module.
npm i @napi-rs/tar
And then enable the next.js instrumentation with the official document
In next.config.js
/** @type {import("next").NextConfig} */
const nextConfig = {
reactStrictMode: true,
experimental: {
instrumentationHook: true,
},
};
module.exports = nextConfig;
In instrumentation.ts, import the node-binding module
import tar from '@napi-rs/tar';
export function register() {
console.log(tar.Entry)
}
Then run project in dev, it crashed
✓ Starting...
○ Compiling /instrumentation ...
⨯ ./node_modules/@napi-rs/tar-win32-x64-msvc/tar.win32-x64-msvc.node
**Module parse failed: Unexpected character '�' (1:2)**
**You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders**
(Source code omitted for this binary file)
Import trace for requested module:
./node_modules/@napi-rs/tar-win32-x64-msvc/tar.win32-x64-msvc.node
./node_modules/@napi-rs/tar/index.js
Error: An error occurred while loading instrumentation hook: Cannot find module 'E:\frontend-projects\reproduction-app\.next\server\instrumentation'
Current vs. Expected behavior
It should import the node-bindings module in instrumentation.ts
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Available memory (MB): 36670
Available CPU cores: 8
Binaries:
Node: 20.10.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 14.2.1-canary.4 // Latest available version is detected (14.2.1-canary.4).
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
DanielPritchard, xveganxxxedgex, timstarbuck-boystown, crusoexia and RNEvok
Metadata
Metadata
Assignees
Labels
InstrumentationRelated to Next.js Instrumentation.Related to Next.js Instrumentation.bugIssue was opened via the bug report template.Issue was opened via the bug report template.