-
Notifications
You must be signed in to change notification settings - Fork 109
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
[HOLD] fix(worker): Avoid webpack error on "node:" modules in workflows #1037
base: main
Are you sure you want to change the base?
Conversation
if (!moduleMatches(module, this.ignoreModules)) { | ||
this.foundProblematicModules.add(module); | ||
} | ||
return 'var {}'; |
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.
Should we change to return an empty object? Is this better experience in your opinion?
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.
Not sure what you mean... Do you mean var false
vs var {}
?
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.
We used to return undefined
here.
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.
Oh, I see... Actually, THIS is the fix.
By returning var {}
, we are telling Webpack to replace imports of that module by an empty object. This is essentially the same as what we do with alias
, but externals
is called much earlier in the process, so that we can still handle invalid namespaces such as node:
.
- Add comments - Completely deny usage of the `node:` prefix, even for things modules that would otherwise be allowed
Putting this one on hold. After some more consideration, I think that the currently proposed solution will make it significantly more difficult for users to load build-time polyfills. For this reason, it might be preferable that we simply rewire |
What changed
externals
hook, in addition toaliases
.Why
node:
prefixed module, Webpack would fail to build, because that namespace is not supported for our target.