niieani / webpack-dependency-suite

A set of Webpack plugins, loaders and utilities designed for advanced dependency resolution
MIT License
35 stars 5 forks source link

NO LONGER MAINTAINED. PLEASE DO NOT USE OR FORK.

Webpack Dependency Suite

Greenkeeper badge A set of loaders, plugins and utilities designed to help with adding custom dependencies to your project.

Usage

TODO.

Plugins

ConventionInvalidatePlugin

This plugin allows customisation of the modules that are invalidated as a result of a change to another module.

By default it will invalidate all modules that share the name as a changed module except for the extension, e.g. if ./index.js was changed and ./index.html was watched, then ./index.html would be invalidated and rebuild.

It is possible to pass in a function to implement a custom invalidation rule instead; the function will be given two arguments, an array of changed modules and an array of all watched modules and should return an array of additional modules which should be invalidated (which should not generally include the changed modules, as they will already be rebuild).

The plugin is used by adding it to the webpack config plugins, e.g.

const { ConventionInvalidatePlugin } = require('webpack-dependency-suite');

const config = {
  // rest of the config somewhere in here
  plugins: {
    // Default behaviour
    new ConventionInvalidatePlugin(),

    // Customised behaviour
    new ConventionInvalidatePlugin((changed, watched) => {
      return [/* list of additional invalidated modules */];
    }),
  },
};

Other Plugins

TODO

Parts of the Suite

require.include loaders

These are a bit like baggage-loader but more configurable and advanced.

Resolve Plugins

Normal Use Plugins

Development / Debugging

There are two scripts that are setup already:

Helpful resources:

Recognition

The repository is based on the fantastic webpack-developer-kit by TheLarkInn, inspired by blacksonics.