-
Notifications
You must be signed in to change notification settings - Fork 80
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
Configuration for SSR environments #43
Comments
I am trying to add it to the edge stack... which means to its built tool: https://github.com/sebastian-software/edge-builder |
Hi @swernerx, If I understood correctly, you wish to have 2 different bundles, What are the results that you're getting with the current setup? There are two important things to note here: If you wish to have 2 different bundles, you can specify that in the entry option, the same way you'll do with webpack's own entry: entry: {
serverVendor: SERVER_VENDOR,
clientVendor: CLIENT_VENDOR
} Second, I believe that you encountered an issue with cache invalidation, where the client/server invalidates each other unnecessarily. One of the conditions for the plugin to invalidate its cache is if the config you pass to it has changed. So in your case: new AutoDllPlugin({
filename: "[name].[chunkhash].js",
context: ROOT,
debug: true,
inject: isProduction && isClient,
entry: {
serverVendor: SERVER_VENDOR,
clientVendor: CLIENT_VENDOR
}
}) For the client, it will be: new AutoDllPlugin({
...
inject: true // <--
entry: {
serverVendor: SERVER_VENDOR,
clientVendor: CLIENT_VENDOR
}
}) For the server, it will be: new AutoDllPlugin({
...
inject: false // <--
entry: {
serverVendor: SERVER_VENDOR,
clientVendor: CLIENT_VENDOR
}
}) That will trigger unnecessary invalidation because the plugins config is different. I realize now that changing For now, know that you can use multiple instances: [
new AutoDllPlugin({
filename: "[name].[chunkhash].js",
context: ROOT,
debug: true,
inject: isProduction,
entry: {
clientVendor: CLIENT_VENDOR
}
}),
new AutoDllPlugin({
filename: "[name].[chunkhash].js",
context: ROOT,
debug: true,
inject: isProduction,
entry: {
serverVendor: SERVER_VENDOR
}
})
] By the way, I would love to hear your feedback about this feature idea: #37 (comment) Have a great day, |
Thanks for the hard work on this plugin. Very much appreciated. I always like the idea of the DLLPlugin but it was generally a hassle to set-up.
Right now I am trying to bring the plugin together with SSR (universal rendering) in my React application framework. I was wondering if there is anything special I have to pass to the plugin config as I would assume there will be different vendor bundles for client and server.
Right now my plugin init code looks like this:
As you mentioned that context is important, I was wondering if there needs to be an additional setting for something like target as server and client code is not able to share the same compiled DLL bundle.
The text was updated successfully, but these errors were encountered: