Webpack SSR bundle differs from client-side bundle using module replacement #13136
-
Describe the bugUsing a module replacement plugin, similar to Webpack's NormalModuleReplacementPlugin, the replaced modules appear only in the client-side bundle and not in the server-side bundle. This causes the application to display wrong components on the SSR output which then gets replaced when client-side JavaScript takes over.
Webpack config:
Expected behaviorReplaced modules should appear in both bundles so the SSR output is rendered correctly. System information
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Not sure what you're trying to achieve exactly but node_modules are not passed through webpack for the server-side. |
Beta Was this translation helpful? Give feedback.
-
Hmm, is there a way to include them? Package X exports component Y, with the replacement plugin we want to replace Y with our own component. Component Y is being referenced by other components in package X and those references are updated with this plugin. |
Beta Was this translation helpful? Give feedback.
-
We fixed it by modifying Webpack externals configuration :) |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is related but I try to get the shim of
And I get errors coming from the full |
Beta Was this translation helpful? Give feedback.
We fixed it by modifying Webpack externals configuration :)