Describe the bug
Example code test.js
import { join } from "node:path";
import { join } from "node:path";
export default join("a", "b")
On Node:
❯ node src/test.js
SyntaxError: Identifier 'join' has already been declared (2:9)
at ModuleLoader.moduleStrategy (https://kkvilbvzkqgithub-l0as.w-credentialless-staticblitz.com/builtins.8cb5228f.js:160:2071)
at ModuleLoader.<anonymous> (https://kkvilbvzkqgithub-l0as.w-credentialless-staticblitz.com/builtins.8cb5228f.js:154:2546)
at async https://kkvilbvzkqgithub-l0as.w-credentialless-staticblitz.com/builtins.8cb5228f.js:155:924
Node.js v18.20.3
On Vite SSR:
❯ node repro.js
[Module: null prototype] { default: 'a/b' }
I noticed this when testing oxc module runner transform in vitejs#85 where oxc rejected such code but current ssr tolerate the same code.
Reproduction
https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/vite-ssr-import-name-already-declared?file=src%2Ftest.js
Steps to reproduce
Open stackblitz and run node repro.js and node src/test.js
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
vite: ^6.2.0 => 6.2.1
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
Example code
test.jsOn Node:
On Vite SSR:
I noticed this when testing oxc module runner transform in vitejs#85 where oxc rejected such code but current ssr tolerate the same code.
Reproduction
https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/vite-ssr-import-name-already-declared?file=src%2Ftest.js
Steps to reproduce
Open stackblitz and run
node repro.jsandnode src/test.jsSystem Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vite: ^6.2.0 => 6.2.1Used Package Manager
npm
Logs
No response
Validations