@talend/react-cmf-webpack-plugin
v6.39.0
Published
@talend/react-cmf webpack plugin for merging CMF settings
Downloads
2,099
Maintainers
Readme
React CMF Webpack Plugin (aka @talend/react-cmf-webpack-plugin)
Simplifies merging of CMF settings files to serve your webpack bundles.
Content
This package provides Webpack plugin to deal with several React CMF settings files.
Installation
Install dependency:
$> yarn add @talend/react-cmf-webpack-plugin
Basic Usage
You must have a cmf.json file at root folder of your project:
{
"settings": {
"sources": ["src/settings", "node_modules/another_package_name/lib/settings/"],
"sources-dev": ["src/settings", "../../another_package_name/src/settings/"],
"destination": "dist/settings.json"
}
}
Edit your webpack.config.js file:
const ReactCMFWebpackPlugin = require('@talend/react-cmf-webpack-plugin');
const webpackConfig = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
},
plugins: [new ReactCMFWebpackPlugin()],
};
Configuration
You can pass a bunch of configuration options to ReactCMFWebpackPlugin. Allowed values are as follows:
| Option | Type | Default | Description |
| ----------- | ------- | ------- | -------------------------------------------------------------------------- |
| dev
| Boolean | false | devSource
entry will be used instead of sources
one in cmf.json file |
| quiet
| Boolean | false | No output at all |
| recursive
| Boolean | false | Recursive search for JSON files |
| watch
| Boolean | false | Watch settings in dev mode |
Here's an example webpack config illustrating how to use these options:
const ReactCMFWebpackPlugin = require('@talend/react-cmf-webpack-plugin');
const webpackConfig = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
},
plugins: [
new ReactCMFWebpackPlugin({
dev: false,
quiet: false,
recursive: false,
watch: process.env.NODE_ENV === 'developement',
}),
],
};