Skip to content
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 CoffeeScript CJS + ESM #3

Merged
merged 5 commits into from
Apr 3, 2022
Merged

Conversation

STRd6
Copy link
Contributor

@STRd6 STRd6 commented Mar 31, 2022

Added call to module._compile to fix CJS loading in combo mode.

Also refactored out compile helper method for compiling CoffeeScript.

// empty object is returned for the module's exports.
// the import does NOT hit ESMLoader or its CJS strategy.
ok(!stdout.includes('Hello from CommonJS!'), 'Named CommonJS import fails');
ok(stdout.includes('Hello from CommonJS!'), 'Named CommonJS import fails');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this pass now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what did the trick was adding module._compile, it looks like?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes adding module._compile was the critical piece. coffeescript/register called it in their implementation so I looked to see what was different here.

@GeoffreyBooth GeoffreyBooth merged commit 213c4d6 into nodejs:main Apr 3, 2022
@STRd6 STRd6 deleted the coffeescript-cjs-esm branch April 3, 2022 03:24
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

Successfully merging this pull request may close these issues.

2 participants