noflo / noflo-component-loader

NoFlo Component Loader generator for WebPack and other module bundlers
3 stars 2 forks source link
noflo webpack-loader

NoFlo Component Loader generator

This utility can be used for generating statically configured NoFlo component loaders when building NoFlo with a module bundler like WebPack.

Usage

Install this library as a development dependency:

$ npm install noflo-component-loader --save-dev

Then configure WebPack to replace NoFlo's dynamic component loader with a generated one. Add to your module.rules:

{
  // Replace NoFlo's dynamic loader with a generated one
  test: /noflo\/lib\/loader\/register.js$/,
  use: [
    {
      loader: 'noflo-component-loader',
      options: {
        // Only include components used by this graph
        // Set to NULL if you want all installed components
        graph: 'myproject/GraphName',
        // Whether to include the original component sources
        // in the build
        debug: false,
      },
    },
  ],
},

Note: If you need to support building on Windows, the test above must be adapted to the \ path separator. Use ([\\]+|\/) instead of \/.

For a more complete example, see the example/ folder.

Changes