0.0.7 ā€¢ Published 7 years ago

d-l-l v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

āš”šŸ¤ø d-l-l

NPM version MIT License fliphub flipfam

easy, automatic, optimized dll config handler for webpack

šŸ“¦ install

yarn add d-l-l --dev
npm i d-l-l --save-dev

šŸ“˜ examples

šŸŒ full api

āš™ advanced config examples

šŸ”— read more webpack dll plugins

šŸ‘‹ intro

Webpack's Dll and DllReference plugins are a way to split a large JavaScript project into multiple bundles which can be compiled independently. They can be used to optimize 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!

āŽ problems with dll plugin:

  • 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

āœ… solution

šŸ–¼ļø screenshots

without d-l-l
with d-l-l

ā” how

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)

  1. when no cache exists, āœš
  2. when there are no manifest files, āœš
  3. when cache-busting-files change, the cache is busted and āœš
  4. every X (default 33) builds āœš
  5. after a day since the last build āœš

see the src code

šŸ“– usage

// webpack.config.js
const DLL = require('d-l-l')

const dll = new DLL()
const configs = dll
  .dir(__dirname)
  .config(config)
  .find()
  .pkgDeps()
  .toConfig()

module.exports = configs