node package manager

webpack-assetgraph-plugin

webpack-assetgraph-plugin

NPM version Build Status Coverage Status Dependency Status

This webpack plugin leverages the very powerful Assetgraph dependency graph model discover assets that webpack doesn't know about. It then adds these assets into webpacks compilation.

This means you can reduce your configuration by avoiding manual maintenance of a manifest of files that need to be copied to the output destination after a build.

Currently webpack-assetgraph-plugin hooks into html-webpack-plugin's html-webpack-plugin-after-emit-hook. This makes html-webpack-plugin a hard dependency for now, which might change in the future.

Usage

In your Webpack configuration add webpack-assetgraph-plugin like so:

var WebpackAssetgraphPlugin require('webpack-assetgraph-plugin');
 
module.exports = {
  context: 'path/to/source/root',
  plugins: [
    new WebpackAssetgraphPlugin({
      verbose: true
    })
  ]
}

Configuring context is important! Assetgraph needs an understanding of what your web root is in order to resolve root-relative urls.

If you don't define context it will default to process.cwd(), which is usually not correct.

Licence

MIT