-
-
Notifications
You must be signed in to change notification settings - Fork 266
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(node): use eval for require to avoid bundler issue #3239
Changes from all commits
0267d1d
451fcad
eb61e96
d6e8545
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@module-federation/node': patch | ||
--- | ||
|
||
use eval for require to avoid bundler warnings |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,7 +12,7 @@ const getRequire = (): NodeRequire => { | |||||||||||||||||||
//@ts-ignore | ||||||||||||||||||||
return typeof __non_webpack_require__ !== 'undefined' | ||||||||||||||||||||
? __non_webpack_require__ | ||||||||||||||||||||
: require; | ||||||||||||||||||||
: eval('require'); | ||||||||||||||||||||
Comment on lines
12
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation using
Suggested change
Additionally, consider adding a comment explaining why this workaround is necessary for webpack bundling to help future maintainers understand the purpose of this code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, we have this CSP problem :( |
||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
function callsites(): any[] { | ||||||||||||||||||||
|
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.
The
@ts-ignore
comment should be replaced with a more specific@ts-expect-error
to better document the expected type error. This helps catch issues if the type error is resolved in the future.