This utility can be used for generating statically configured NoFlo component loaders when building NoFlo with a module bundler like WebPack.
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.
getLanguages
methoddebug
option is enabledgetLanguages()
component loader methodgetSource
handling of components without a library prefixsetSource
failures now provide more verbose errors including the component library and name