-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
feat: add moduleFederation option #938
base: main
Are you sure you want to change the base?
Changes from 6 commits
6c24c14
bf7dda7
f1b058c
c6939b8
ae04c10
be7f129
14cd316
50d8406
66e6786
90ced6f
36158cc
3f582c9
3b2c37d
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 | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -101,6 +101,19 @@ class LoadablePlugin { | |||||||||||||||||||
apply(compiler) { | ||||||||||||||||||||
this.compiler = compiler | ||||||||||||||||||||
|
||||||||||||||||||||
const { webpack } = compiler | ||||||||||||||||||||
|
||||||||||||||||||||
const defs = { | ||||||||||||||||||||
'process.isBrowser': | ||||||||||||||||||||
compiler.options.target === 'web' || | ||||||||||||||||||||
compiler.options.target === undefined, | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// eslint-disable-next-line global-require | ||||||||||||||||||||
new ((webpack && webpack.DefinePlugin) || require('webpack').DefinePlugin)( | ||||||||||||||||||||
defs, | ||||||||||||||||||||
).apply(compiler) | ||||||||||||||||||||
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. with my suggestion this would become
Suggested change
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. Nice job @bwhitty, I will test it here!! 🚀 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. @theKashey I am not being able to get the value of
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. @ScriptedAlchemy I got these snippets from NodeFederationPlugin do you have some idea why I can't get the serverSideModuleFederation during babel compilation execution? |
||||||||||||||||||||
|
||||||||||||||||||||
const version = 'jsonpFunction' in compiler.options.output ? 4 : 5 | ||||||||||||||||||||
|
||||||||||||||||||||
// Add a custom chunk loading callback | ||||||||||||||||||||
|
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.
To go with my suggestion of adding a
serverSideModuleFederation
argument to the webpack plugin, if we do then this logic could throw an error for misconfiguration: