Skip to content

JSON files loaded via dynamic import() no longer trigger HMR after upgrading to 16.2 #91766

@guoxinghuang

Description

@guoxinghuang

Link to the code that reproduces this issue

https://github.com/guoxinghuang/next-intl-hmr-repro

To Reproduce

  1. Clone the repo and pnpm install
  2. Run pnpm dev (uses Turbopack by default in 16.2)
  3. Open http://localhost:3000
  4. Edit messages/en.json (e.g., change "Hello World" to "Hello Next.js")
  5. Observe: the page does not update — a full server restart is required

Current vs. Expected behavior

Current (16.2.0): Editing a JSON translation file loaded via await import(../../messages/${locale}.json) does not trigger HMR. The dev server shows no recompilation. A full restart is required to see changes.

Expected (worked in 16.1.x): Editing the same JSON file triggered HMR and the page updated automatically without a restart.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin 25.3.0

Binaries:
  Node: 22.x
  pnpm: 10.28.0

Relevant Packages:
  next: 16.2.0
  react: 19.2.4
  react-dom: 19.2.4
  next-intl: 4.8.3

Which area(s) are affected?

Turbopack, HMR

Which stage(s) are affected?

next dev (development)

Additional context

This is a regression from 16.1.x → 16.2.0. JSON translation file HMR worked correctly in 16.1.

The 16.2 Turbopack release introduced two changes that may be related:

  1. Server Fast Refresh — changed from clearing the full require.cache import chain to only reloading the actually-changed module. Dynamic import() with template literal paths may not be tracked as a dependency, so dependents are not invalidated when the JSON file changes.

  2. Tree Shaking of Dynamic Imports — Turbopack now tree-shakes destructured dynamic imports. This could affect how dynamic JSON imports are tracked in the module graph.

Downgrading to 16.1.x restores the expected HMR behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions