vercel / vercel/next.js

`next dev --turbo` loads module provided through `NODE_OPTIONS="--require module.js"`

Open
#77,093 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Turbopack
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/psimk/next-turbo-webpack-loader-node-option-require-reproduction

To Reproduce
  1. Run npm dev
  2. Send a request to the root route, e.g. curl http://localhost:3000
  3. See that ⬇ is logged.
Hi, from node-require.js with {
  pid: 74115,
  ppid: 74083,
  argv: [
    '/Users/<user>/.local/share/mise/installs/node/20.18.3/bin/node',
    '/Users/<user>/turbo-node-require/.next/webpack-loaders.js',
    '57879'
  ]
}
Current vs. Expected behavior

I didn't expect the log I placed in node-require.js to fire. Meaning, that the webpack-loaders.js module, loaded by turbopack, also required the module I provided through NODE_OPTIONS.

My expectation, is that this either doesn't happen or there is an opt-out.

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 20.18.3
  npm: 10.8.2
  Yarn: 1.22.21
  pnpm: 10.6.2
Relevant Packages:
  next: 15.2.2 // Latest available version is detected (15.2.2).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction and run npm dev, then inspect the generated .next/webpack-loaders.js entry point and how NODE_OPTIONS=--require reaches it. Compare the observed module loading with the expected Turbopack next dev behavior; done means the unintended loading is prevented or a documented opt-out is available, with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, node.js
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.