Error: No matching export in <file> for import <named import>.
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hello! I encountered a problem when one of the entry points contains an absolute path to the cdn.
Example:
```js
// index.js
import { useState } from "./shared-react-package.js";
```
```js
// shared-react-package.js
export * from "https://esm.sh/react@18.3.1/es2022/react.development.mjs";
export { default } from "https://esm.sh/react@18.3.1/es2022/react.development.mjs";
```
Run `esbuild index.js shared-react.package.js --bundle --outdir=out --conditions=development --format=esm --splitting`
My case:
- project on vite
- there is an alias on react: react@npm:shared-react
- there is an package @react-hookz/web
- run script "dev": "vite"
Vite starts the optimizer with deps:
- node_modules/@react-hookz/web/dist/useAsync/index.js (contain named imports from react)
- node_modules/react/react.development.js (react alias of npm. contain re-export esm.sh)
Can I hope that this will work in future versions?
node: 20.17.0
esbuild: 0.25.1
vite: 6.2.2
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with index.js and shared-react-package.js using the provided esbuild command and dependency setup. Start by tracing how the bundler handles the named import from the absolute CDN re-export, then compare the result with the reported error. Done means the behavior is either corrected for this case or its limitation is clearly documented and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, vite
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100