- Notifications
You must be signed in to change notification settings - Fork0
fliphub/d-l-l
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
easy, automatic, optimized dll config handler for webpack
yarn add d-l-l --devnpm i d-l-l --save-dev
Webpack'sDll and DllReference plugins are a way to split a large JavaScript project into multiple bundles which can be compiled independently. They can be used tooptimize build times (both full and incremental) and improve caching for users by putting code which changes infrequently into separate "library" bundles.- Robert Knight
Unfortunately, the DLL plugins come with some problems.
ℹ️️ This package aims to provide solutions for them by allowing you to pass in any existing webpack config, then get it back decorated with dll-reference-plugins and (only when needed) a whole dll-plugin-only config prepended!
- can be a pain to configure
- requires manually adding plugins, and the entry points in your source code alongside the package dependencies
- requires multiple config files
- requires multiple build scripts
- requires manual cache busting when you change code, which makes it difficult to dynamically include code that does not often change
- does not work without even more configuration on nodejs
- no need to have double config files or double build scripts just for dll
- adding filesthat do not change often
- adding package dependencies with easy filtering
- easy (even one line) setup
- clearing the cache automatically when needed
Webpack allows exporting an array of configs, so when required, a DLL-only config is created using the provided config(s) & prepended to the array of configs.
Cache files are created in a.fliphub
folder (can be safely added to gitignore, similar to.happypack or similar).This helps to provide some smart-ish checks:
✚ = (dll config will be prepended)
- when no cache exists, ✚
- when there are no manifest files, ✚
- whencache-busting-files change, the cache is busted and ✚
- every X (default 33) builds ✚
- after a day since the last build ✚
// webpack.config.jsconstDLL=require('d-l-l')constdll=newDLL()constconfigs=dll.dir(__dirname).config(config)// (dependencies, dev, all).pkgDeps(deps=>deps.filter(dep=>!/lodash/.test(dep))).toConfig()module.exports=configs
// webpack.config.jsconstDLL=require('d-l-l')constdll=newDLL()constconfigs=dll.dir(__dirname).config(config).find()// defaults to bundledDependencies, fallback to dependencies.pkgDeps().toConfig()module.exports=configs