-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Issue with hybrid module import when using cjs #2976
Comments
I don't think I can reproduce this given your description. Here's the code I tried: import logger_esm from 'euberlog'
logger_esm.info('esm')
const logger_cjs = require('euberlog').default
logger_cjs.info('cjs') Bundling that with
So everything seems fine. You have to provide a way to independently reproduce your issue in your issue report. |
The source code for the cjs does not use require, it uses Then, via typescript, it is built in a wrong way, I think by esbuild Here is the repo I'm using, the command is |
Does this add enough information to replicate the issue? |
I think I'm experiencing this breaking behavior with my packages. If I have the following code in my package: // example-cjs
export default function example() {
// some code
} and import it like this import example from 'example-cjs';
console.log(example); It logs Edit: |
Any news? |
I am building a module with esbuild. It uses
euberlog
as a dependency, which is an hybrid module providing both esm and cjs support.In my code I therefore use:
And then I compile it with esbuild:
It is actually built both for esm and cjs.
The problem is that if I import the cjs module somewhere, I have the error:
and then if I patch the code and print
i
, I see that the result is:It seems like that esbuild translates the first import (
import logger from 'euberlog'
) asimport * as logger from 'euberlog'
, but this does not make sense.The text was updated successfully, but these errors were encountered: