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
Can not export the name-imported with default in transpiled cjs #3029
Comments
You mentioned "transpiled", what are the actual files in runtime? What runtime is it? It sounds like #2486 where esbuild currently does not emit any code for node.js to infer re-exports from cjs code. But you can provide a self-contained reproduction to make it clear. In fact, the transform mode does not produce the "unbundled" result (or let's call it preserve modules as in rollup, which is not supported yet: #708). Any try to use it like that will likely to fail. |
@evanw 0.17.15 Still Can not export the name-imported, report error now: But can workaround: import util from 'util-ex';
const fn = util.fn; If wanna named exported on node, do not overrite the |
I added a test case based on your incomplete reproduction: b86e581#diff-6058dc2cc79db56a46212b92b928329c09ac9f8a3f41c6ce8edbafb3d6050613R1990-R2023. That test case failed before 0.17.15 and passed with 0.17.15, which is why I considered this issue to be fixed. If you still believe that there is a bug with esbuild, then please provide a complete reproduction. That would include at minimum all relevant files and all instructions necessary to reproduce the bug. |
Your repl has a mistake in package.json |
@hyrious which means other package(esm) call the cjs pacakge! The SWC has the same issue, but It fixed now since I've reported. You can chagne the js to cjs in the lib dir is the same result. |
The ESM js files to transpile:
Used it in another esm package after transpiled, found no
cloneObject
exported. exported only after commenting theexport default cloneObject
The text was updated successfully, but these errors were encountered: