-
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
Comparison to webpack-dll-bundles-plugin #24
Comments
Great question, @cgatian To be honest, I wasn't aware of webpack-dll-bundle-plugin when I wrote this one. AutoDLL started as a humble PR for adding DLL support in create-react-app (CRA). That PR went over many iterations before I realized one day that the best way to do so is to encapsulate the entire logic into a Plugin. After doing so, I noticed there's nothing specific to CRA about it anymore and that other projects can benefit from it too. Key differencesFirst, I must say that I have very little experience with webpack-dll-bundles-plugin, Cache dirDllBundles asks you to specify its cache directory, which is also its output folder. AutoDLL hides that away from you and uses find-cache-dir to stores its cache inside That has the benefit of automaticity invalidating the cache every time Webpack's dev-server supportDllBundles seems to create the DLLs in your project also when you use the dev-server. One of webpack's dev-server features is that it stores the assets in the memory instead for faster access, and allows you to access them as if the were just regular files. AutoDLL respects that and when the devServer is used, the DLLs are added to the memory as well. Filename templatesSeems like DllBundles doesn't allow to change the DLL's filename, and to get it you have to use an external API like so: new AddAssetHtmlPlugin([
{ filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('polyfills')}`) },
{ filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('vendor')}`) }
]) AutoDLL handles it differently. new AutoDllPlugin({
path: './dll',
filename: '[name].dll.js'
entry: {
vendor: [ ... ]
},
...
}) Then in the HTML you can use: <script src="/dll/vendor.dll.js"></script> You might also want to use a filename template like so: That's why AutoDLL recommends using the HtmlPlugin plugins: [
new HtmlWebpackPlugin({
inject: true,
template: './src/index.html',
}),
new AutoDllPlugin({
inject: true, // ⟸
context: __dirname,
filename: '[name]_[hash].js',
path: './dll',
entry: {
vendor: [
'react',
'react-dom',
'moment'
]
}
})
] Will result in <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script src="/dll/vendor.dll.js"></script>
<script src="/main.bundle.js"></script>
</body>
</html> InvalidationIf I understood correctly, DllBundles checks the contents of each module's package.json AutoDLL currently have to two conditions for invalidation
There's also a very exciting PR on the way, which will allow any change to be detected. For examples, you'll be able to add TestCurrently, I don't see tests in DllBundles. AutoDLL designed to be testable from the ground up, I believe it's essential for the project's stability. DocumantaionAlthough it's still much a WIP, I believe in having great documentation with many examples and FAQ. |
Wow, thank you @asfktz for the in depth comparison! I look forward to integrating this into our project, once some of the bumps are cleaned up. Thank you again. 🙏 |
You're welcome, @cgatian 😊 |
What does this plugin do that webpack-dll-bundles-plugin doesn't?
Looking at the two plugins, they are very similar.
The text was updated successfully, but these errors were encountered: