-
Notifications
You must be signed in to change notification settings - Fork 24
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(nodelss): use valid esm inject paths #369
Conversation
Hey @niksy could you expand on how you use/test the cloudflare preset? The cloudflare preset match the ESBuild plugin that is used in wrangler. wrangler uses that plugin whenever you have the
The tests should not specify I hope this helps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments in the PR conversation.
Happy to discuss further when you explain more about your usage.
@vicb I haven’t changed anything for Cloudflare preset, this is Nodeless preset. I think this preset is not used for Cloudflare Workers so changes in this preset shouldn’t affect Cloudflare usage. Correct me if I’m wrong? As for workerd changes, I didn’t know there is definition to use Nevertheless, I still get same error locally when running test even without these changes, although you’re right, it passes in the CI. Is there something that needs to be set locally for this to work (I’m not blocked by this, just trying to see if I’m using this correctly :))? As for my following question
I’ve been using this module without aliasing anything, only injecting values, so |
Oops I thought you updated the cloudflare preset because the workerd test were modified, I should have paid more attention. Cloudflare preset inherits from nodeless so it might need to get updated when nodeless is. Workerd tests work out of the box for me. I'll look at the changes during the week. |
From what I can see, Cloudflare preset explicitly references |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. It is the right change as ESM resolution does require explicit paths (in this case, export subpaths) + cloudflare preset explicitly overrides both
As per
exports
definition in package.json, some modules don’t have fully qualified specifier so using them throwsERR_MODULE_NOT_FOUND
error.Two other things to note:
Is there a reason why we don’t use unev version of Buffer? Currently it’s expected
buffer
package is installed but I thinks was not intended?I’ve tried running tests for Workerd but I’m getting following error:
Error output