@talend/react-cmf-webpack-plugin

6.38.1 • Public • Published

React CMF Webpack Plugin (aka @talend/react-cmf-webpack-plugin)

Simplifies merging of CMF settings files to serve your webpack bundles.

NPM

Travis CI Quality dependencies devdependencies Codacy Badge

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',
		}),
	],
};

Package Sidebar

Install

npm i @talend/react-cmf-webpack-plugin

Weekly Downloads

317

Version

6.38.1

License

Apache-2.0

Unpacked Size

20.2 kB

Total Files

6

Last publish

Collaborators

  • talend-frontend