-
Notifications
You must be signed in to change notification settings - Fork 364
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
fix: CJS export default #673
Conversation
@richarddavison , I built commit#c8a60db on my laptop and checked the require calls for the packages I have tried so far and no regressions seem to occur in them. However, in reproduction tests of previously resolved issues, regressions seem to be occurring. NOTE: llrt-clone built commit#c8a60db.
// hello.js
var hello = function world() {
return "hello world"
}
module.exports = hello; // main.js
import hello from './hello.js'
console.log(hello())
// main.js
import hello from './hello.cjs' // The content is exactly the same as hello.js
console.log(hello())
|
I have not been able to confirm the assert module that was uncovered this time because it has not been merged into the mainline. If you could rebase it after the merge, I can check it for you. :) |
The following error still occurs when importing, but the situation has not changed since before this fix, so it is a different issue. I would like to verify more after this PR is merged...
|
I looked at this. Lodash import should now work in this PR |
import { Logger } from '@aws-lambda-powertools/logger';
console.log(Logger);
Since the |
Description of changes
CJS imports via ESM now returns the default export if present. This should help with #668 and maintain better consistency with Node.
@nabetti1720 even tho all testes are passing, can you verify this doesn't change expected CJS import behavior from ESM?
Checklist
tests/unit
and/or in Rust for my feature if neededmake fix
to format JS and apply Clippy auto fixesmake check
types/
directoryBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.