esm.sh
esm.sh copied to clipboard
Failed to import antd
Failing module
- GitHub: https://github.com/ant-design/ant-design
- npm: https://www.npmjs.com/package/antd
import { Button } from "https://esm.sh/antd"
Error message
Uncaught SyntaxError: The requested module '/@ant-design/colors@^7.0.0?target=es2022&dev' does not provide an export named 'blue' (at AntdIcon.js:10:10)
The error was caused by https://www.npmjs.com/package/@ant-design/colors
The bundle output was wrong. Maybe was caused by last export * from "./types"; , I guess.
I get this issue too
esbuild ignores named exports defined by export * expr, i added a workaround for single export *, multiple export * currently cannot work
see https://github.com/evanw/esbuild/issues/1737
esbuild ignores named exports defined by
export *expr, i added a workaround for singleexport *, multipleexport *currently cannot work
I submitted a PR to @ant-design/colors, and it has been merged. Right now there's only one export * statement left in the module, but it's still throwing an error.
import { blue } from 'https://esm.sh/@ant-design/colors' still does't work.
But
import colors from 'https://esm.sh/@ant-design/colors';
const blue=colors.blue;
worked
Same error here. It seems that many libraries might be affected by this issue. While I can work around it by destructuring from default in my own usage, it's hard to avoid problems when it's used this way by intermediary libraries. I’d greatly appreciate any insights or potential solutions.
esbuild ignores named exports defined by
export *expr, i added a workaround for singleexport *, multipleexport *currently cannot work
I noticed that @ant-design/colors does not have a default export, but the version processed by esm.sh bundles all named exports into the default, while the named exports themselves are missing. I'm not very familiar with esm.sh’s bundling process.
@gxy01 mentioned that he submitted a PR to @ant-design/colors, but the issue still hasn't been resolved.
I’d really appreciate any help or suggestions you can provide. Thank you for taking the time to look into this!