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

[ESM] Support wrapping a custom loader #278

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kherock
Copy link
Contributor

@kherock kherock commented Mar 25, 2022

Closes #242

This adds support for custom ESM loaders options passed via --experimental-loader to node-dev. I accomplish this by passing the resolved loader path as a query string argument to node-dev's own ESM loader implementation.

Also, keeping this as a draft until #279 is merged since those changes are more important and this branch builds on top of those commits.

@kherock
Copy link
Contributor Author

kherock commented Mar 25, 2022

This PR still doesn't solve scenarios where the ESM loader is passed via NODE_OPTIONS, which is a problem for Yarn 2+ users. To make that work properly we need to rewrite process.env.NODE_OPTIONS with the appropriate loader.

Would it be acceptable to always pass the rewritten loader path by appending a string onto process.env.NODE_OPTIONS instead of passing it as a node arg?

@kherock kherock marked this pull request as draft March 26, 2022 05:40
@bjornstar
Copy link
Collaborator

Would it be acceptable to always pass the rewritten loader path by appending a string onto process.env.NODE_OPTIONS instead of passing it as a node arg?

node-dev should not be manipulating environment variables.

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.

Support third party ESM loader
2 participants