You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The returned error message is not human-friendly when mistyping imports.
Reproduction
Create a super simple Vite app.
File a.js: import * as React from 'react'; // lower case
File b.js: import * as React from 'React'; // oops typo, used uppercase R
Pre-bundling dependencies:
React
react-dom
react
(this will be run only when your dependencies or config have changed)
> error: Two output files share the same path but have different contents: node_modules/.vite/react.js.map
> error: Two output files share the same path but have different contents: node_modules/.vite/react.js
error when starting dev server:
Error: Build failed with 2 errors:
error: Two output files share the same path but have different contents: node_modules/.vite/react.js.map
error: Two output files share the same path but have different contents: node_modules/.vite/react.js
at failureErrorWithLog (/Users/eirik/projects/vite-hmr-fails/node_modules/esbuild/lib/main.js:1224:15)
at buildResponseToResult (/Users/eirik/projects/vite-hmr-fails/node_modules/esbuild/lib/main.js:936:32)
at /Users/eirik/projects/vite-hmr-fails/node_modules/esbuild/lib/main.js:1035:20
at /Users/eirik/projects/vite-hmr-fails/node_modules/esbuild/lib/main.js:568:9
at handleIncomingPacket (/Users/eirik/projects/vite-hmr-fails/node_modules/esbuild/lib/main.js:657:9)
at Socket.readFromStdout (/Users/eirik/projects/vite-hmr-fails/node_modules/esbuild/lib/main.js:535:7)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
Suggested solution?
Vite could run .toLowerCase() on package import names before doing its magic. Or it could detect the problem and show a more specific message. I'm not sure how other bundlers are handling this, or how ESM modules should behave natively in the browser. Are they case sensitive?
The text was updated successfully, but these errors were encountered:
The issue seems to be specific to case-insensitive filesystems. toLowerCase() might work but could be risky for case-sensitive filesystems. Overall I'm not sure if it's worth the effort for a better error message, the Pre-bundling dependencies: message already showed the incorrect casing.
Describe the bug
The returned error message is not human-friendly when mistyping imports.
Reproduction
Create a super simple Vite app.
File a.js:
import * as React from 'react'; // lower case
File b.js:
import * as React from 'React'; // oops typo, used uppercase R
See "logs" below for the error message.
System Info
Used package manager: npm
Logs
Suggested solution?
Vite could run .toLowerCase() on package import names before doing its magic. Or it could detect the problem and show a more specific message. I'm not sure how other bundlers are handling this, or how ESM modules should behave natively in the browser. Are they case sensitive?
The text was updated successfully, but these errors were encountered: