Skip to content

Error: No matching export in <file> for import <named import>. #4124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nextgennexia opened this issue Mar 25, 2025 · 1 comment
Open

Error: No matching export in <file> for import <named import>. #4124

nextgennexia opened this issue Mar 25, 2025 · 1 comment

Comments

@nextgennexia
Copy link

Hello! I encountered a problem when one of the entry points contains an absolute path to the cdn.

Example:

// index.js
import { useState } from "./shared-react-package.js";
// shared-react-package.js
export * from "https://esm.sh/[email protected]/es2022/react.development.mjs";
export { default } from "https://esm.sh/[email protected]/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

@hyrious
Copy link

hyrious commented Mar 25, 2025

Just want to add the playground link where rollup works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants