question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: a simplified version of the DllPlugin

See original GitHub issue

I was amazed to discover how significant is the impact the DllPlugin has on build performance, especially when projects get bigger.

Here are some numbers I measured on my machine, for a project with a decent amount of dependencies:

Without DllPlugin With DllPlugin
Build Time 16461ms - 17310ms 2991ms - 3505ms
DevServer Rebuild 2924ms - 2997ms 316ms - 369ms

Current drawbacks of the DllPlugin

While The DllPlugin is great, its main drawback is the amount of boilerplate it adds to the project.

  • separate configuration You have to manage the DLL config separate from the main config and build it in advance.
  • Invalidation You have to write your own logic for invalidation or build it by hand. Otherwise, things can get out of sync.

Suggested Solution

Two months ago, while working on a PR to add DLL support for create-react-app, I realized that it is possible to overcome these drawbacks by introducing a high-level version of the plugin that will handle all of the boilerplate by itself.

Which led me to write autodll-webpack-plugin.

This is how it works:

  • You add it to your config as a regular plugin (no external config required):
module.exports = {
  entry: {
    app: './src/index.js'
  },

  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist')
    publicPath: '/'
  },

  plugins: [
    new AutoDllPlugin({
      filename: '[name].dll.js',
      entry: {
        vendor: [
          'react',
          'react-dom',
          'moment'
        ]
      }
    })
  ]
};
  • When you run webpack, the plugin creates the DLL config in memory and builds it before it builds yours. It still uses DllPlugin and DllReferencePlugin under the hood.
  • It stores the DLL files in a cache directory, and saves it in a memory-fs too, for faster access when using the dev server.
  • On every run, the plugin checks if the cache is still valid, otherwise it will trigger a rebuild.
  • There are two conditions for cache invalidation:
    • The options passed to the plugin changed
    • package.json changed (by npm / yarn, or by hand)

Challenges

I got to the point that users request features, such as support for plugins, loaders, inheriting from the parent config, and I encounter problems that are far beyond my understanding of webpack. I worry that I can no longer maintain it alone.

Request

I believe this plugin has potential and people seems to like it.

I hope that maybe one of your team members can take over the project and develop an official version of it, one that will address its current limitations and better fit with webpack’s standards.

With gratitude, Asaf.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:16
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Nargonathcommented, Sep 8, 2017

I’m currently working with @asfktz on this: https://github.com/asfktz/autodll-webpack-plugin/issues/54. I’d be happy to help with whatever works is required to improve the current DLLPlugin implementation. I may not have the best and deepest webpack knowledge but I’m willing to learn and to help.

0reactions
alexander-akaitcommented, Oct 25, 2021

Yes, agree, let’s close, solution - Module Federation

Read more comments on GitHub >

github_iconTop 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 >
A MP3/RTP input plugin for Winamp - LIVE555.COM
Important Note: This plugin works for Winamp version 2 or 5. ... With the "in_rtp.dll" plugin installed, you can receive a MP3/RTP stream...
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 >
MapServer for Windows (MS4W) README - Idaho Parcels
Introduction. Welcome to MS4W, the quick and easy installer for setting up MapServer For Windows and its accompanying applications (e.g. ...
Read more >
Remote Access Clients for Windows Administration Guide
Download the latest version of this document in PDF format. ... The Remote Access VPN Software Blade provides a simple and secure procedure ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found