Skip to content

[Bug]: cannot resolve import from next-intl/navigation #35162

@stefanprobst

Description

@stefanprobst

Version

1.51.0

Steps to reproduce

  1. clone the reproduction at https://github.com/stefanprobst/issue-playwright-bundler
  2. pnpm install
  3. pnpm test
  4. see error message:
Error: Cannot find module '/home/stefan/Development/playground/issue-playwright-bundler/node_modules/.pnpm/next-intl@4.0.0-beta-dea867b_next@15.2.2_@playwright+test@1.51.0_react-dom@19.0.0_react_fccdb3ffef8c0b4edb06eee065c5b512/node_modules/next/navigation' imported from /home/stefan/Development/playground/issue-playwright-bundler/node_modules/.pnpm/next-intl@4.0.0-beta-dea867b_next@15.2.2_@playwright+test@1.51.0_react-dom@19.0.0_react_fccdb3ffef8c0b4edb06eee065c5b512/node_modules/next-intl/dist/esm/production/navigation/react-client/createNavigation.js
Did you mean to import "next/navigation.js"?

Expected behavior

playwright should be able to resolve imports from next-intl/navigation

Actual behavior

playwright cannot resolve imports from next-intl/navigation and errors with:

Error: Cannot find module '/home/stefan/Development/playground/issue-playwright-bundler/node_modules/.pnpm/next-intl@4.0.0-beta-dea867b_next@15.2.2_@playwright+test@1.51.0_react-dom@19.0.0_react_fccdb3ffef8c0b4edb06eee065c5b512/node_modules/next/navigation' imported from /home/stefan/Development/playground/issue-playwright-bundler/node_modules/.pnpm/next-intl@4.0.0-beta-dea867b_next@15.2.2_@playwright+test@1.51.0_react-dom@19.0.0_react_fccdb3ffef8c0b4edb06eee065c5b512/node_modules/next-intl/dist/esm/production/navigation/react-client/createNavigation.js
Did you mean to import "next/navigation.js"?

it looks like it has something to do with esm requiring a .js extension on imports from transitive dependencies?

note that next-intl imports work fine in an actual next.js project (which sets tsconfig.json#moduleResolution to bundler, which i think playwright is trying to match)

Additional context

No response

Environment

System:
    OS: Linux 6.8 KDE neon 6.2 6.2
    CPU: (16) x64 AMD Ryzen 7 5800U with Radeon Graphics
    Memory: 21.44 GB / 30.66 GB
    Container: Yes
  Binaries:
    Node: 22.14.0 - ~/.local/share/pnpm/node
    Yarn: 1.22.22 - ~/.local/share/pnpm/yarn
    npm: 10.9.2 - ~/.local/share/pnpm/npm
    pnpm: 10.5.2 - ~/.local/share/pnpm/pnpm
    bun: 1.1.37 - ~/.bun/bin/bun
  IDEs:
    VSCode: 1.98.0 - /usr/bin/code
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.51.0 => 1.51.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions