Compatibility with Webpack DLL Plugins?
See original GitHub issueI’ve been trying to reduce the webpack build times on my setup and tried to implement the DLL Plugins as outlined by vjpr
here: https://github.com/erikras/react-redux-universal-hot-example/issues/616
Compilation works well, but when starting the application, I get these cryptic errors associated to any .scss
files I require.
Is something wrong with my wepack-isomorphic-tools
configuration? Or do you think the problem arises from somewhere else?
Error:
[0] 2e806729f506f9eebf83b7fd00853881.png 27.4 kB [emitted]
[0] app.dll.js 4.43 MB 0 [emitted] app
[0] /Users/yyyyy/xxxxx/xxxxx-react/src/components/Cover/Cover.scss.webpack-module:2
[0] exports = module.exports = require("./../../../node_modules/css-loader/lib/css-base.js")();
[0] ^
[0]
[0] TypeError: require(...) is not a function
[0] at Object.<anonymous> (/Users/yyyyy/xxxxx/xxxxx-react/src/components/Cover/Cover.scss.webpack-module:2:89)
[0] at Module._compile (module.js:413:34)
[0] at Object._module3.default._extensions.(anonymous function) [as .webpack-module] (/Users/yyyyy/xxxxx/xxxxx-react/node_modules/require-hacker/babel-transpiled-modules/require hacker.js:264:11)
[0] at Module.load (module.js:357:32)
[0] at Function.Module._load (module.js:314:12)
[0] at Module.require (module.js:367:17)
[0] at require (internal/module.js:16:19)
[0] at populate_assets (/Users/yyyyy/xxxxx/xxxxx-react/node_modules/webpack-isomorphic-tools/babel-transpiled-modules/plugin/write assets.js:375:31)
[0] at Object.write_assets [as default] (/Users/yyyyy/xxxxx/xxxxx-react/node_modules/webpack-isomorphic-tools/babel-transpiled-modules/plugin/write assets.js:63:2)
[0] at Compiler.<anonymous> (/Users/yyyyy/xxxxx/xxxxx-react/node_modules/webpack-isomorphic-tools/babel-transpiled-modules/plugin/plugin.js:175:27)
Config:
module.exports = {
assets: {
// ...
scss: {
extensions: [ 'scss' ],
filter: function( module, regex, options, log ) {
if( options.development ) {
return WebpackIsomorphicToolsPlugin.style_loader_filter( module, regex, options, log )
} else {
return regex.test( module.name )
}
},
path: function( module, options, log ) {
if( options.development ) {
return WebpackIsomorphicToolsPlugin.style_loader_path_extractor( module, options, log )
} else {
return module.name
}
},
parser: function( module, options, log ) {
if( options.development ) {
return WebpackIsomorphicToolsPlugin.css_modules_loader_parser( module, options, log )
} else {
return module.source
}
}
}
}
}
Loader:
{
test: /\.scss$/,
loader: 'style!css?module&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap&'
},
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
DllPlugin - webpack
This plugin is used in a separate webpack configuration exclusively to create a dll-only-bundle. It creates a manifest.json file, which is used by...
Read more >Improve your webpack build with the DLL plugin
This tutorial shows you how to improve build times when working with webpack as a dependency for build tools using the DLL plugin....
Read more >DllReferencePlugin with multiple dll requires loading all #8078
In webpack.dll config you can have multiple entrypoints, which would mean you have multiple dll js and multiple dll manifest files, completely ...
Read more >Does the DLL Plugin do anything when using Webpack@5.x?
Is it no longer compatible? Just not beneficial anymore for performance? I can't figure out what the deal is with this plugin post-Webpack...
Read more >Webpack DllPlugin and DllReferencePlugin - Medium
The Dll and DllReference plugins allow the code to be split in multiple bundles in a way the bundles can be compiled independently....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI I’m posting this in every issue and PR to notify whoever may be interested: today I’ve released an alternative helper library called
universal-webpack
. It takes a different approach thanwebpack-ismorphic-tools
and instead of hacking Node.jsrequire()
calls it just compiles all code withtarget: 'node'
webpack configuration option. As a result, all Webpack plugins and features are supported. If you think you might need that here’s an example project: https://github.com/halt-hammerzeit/webpack-react-redux-isomorphic-render-exampleThanks for the instructions. Maybe some people will find them useful.