Skip to content

turbopack removes side effects, breaking module initialization. #76881

Closed
@stainless-em

Description

@stainless-em

Link to the code that reproduces this issue

https://github.com/stainless-em/turbopack-repro

To Reproduce

run yarn next --turbo or yarn next build. yarn next is not affected.

Current vs. Expected behavior

the initializer in index.mjs should be called. instead, turbopack skips over index.mjs and imports directly from registry.mjs, which means the initialization code isn't run.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: 9.15.5
Relevant Packages:
  next: 15.2.1 // Latest available version is detected (15.2.1).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: N/A
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), next build (local)

Additional context

This is impacting users of @mux/mux-node among other libraries

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.locked

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions