@@ -30,6 +30,22 @@ function loadViaWebpackNoCache(webpackConfigPath, modulePath) {
3030 webpackConfig . plugins = webpackConfig . plugins . filter ( function ( plugin ) {
3131 return ! ( plugin instanceof webpack . optimize . CommonsChunkPlugin ) ;
3232 } ) ;
33+
34+ // The typical use case for DllReferencePlugin is for referencing vendor modules. In a Node
35+ // environment, it doesn't make sense to load them from a DLL bundle, nor would that even
36+ // work, because then you'd get different module instances depending on whether a module
37+ // was referenced via a normal CommonJS 'require' or via Webpack. So just remove any
38+ // DllReferencePlugin from the config.
39+ // If someone wanted to load their own DLL modules (not an NPM module) via DllReferencePlugin,
40+ // that scenario is not supported today. We would have to add some extra option to the
41+ // asp-prerender tag helper to let you specify a list of DLL bundles that should be evaluated
42+ // in this context. But even then you'd need special DLL builds for the Node environment so that
43+ // external dependencies were fetched via CommonJS requires, so it's unclear how that could work.
44+ // The ultimate escape hatch here is just prebuilding your code as part of the application build
45+ // and *not* using asp-prerender-webpack-config at all, then you can do anything you want.
46+ webpackConfig . plugins = webpackConfig . plugins . filter ( function ( plugin ) {
47+ return ! ( plugin instanceof webpack . DllReferencePlugin ) ;
48+ } ) ;
3349
3450 // Create a compiler instance that stores its output in memory, then load its output
3551 var compiler = webpack ( webpackConfig ) ;
0 commit comments