karolis-sh/rollup-plugin-json-merge(新しいタブで開きます)
主要言語: JavaScript
A Rollup plugin to merge multiple JSON sources into one
- star 数
- 2
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 1
- 最終更新
- 2021/07/09
主要言語: JavaScript
A Rollup plugin to merge multiple JSON sources into one
🍣 A Rollup plugin to merge multiple JSON sources into one.
Using npm:
npm i rollup-plugin-json-merge --save-devUsing yarn:
yarn add rollup-plugin-json-merge -DCreate a rollup.config.js configuration file
and import the plugin:
import merge from 'rollup-plugin-json-merge'; import { name, version, description } from './package.json'; export default { input: 'src/index.js', output: { dir: 'output', format: 'cjs', }, plugins: [ merge({ input: [{ name, version, description }, 'src/manifest.json', 'src/data/*.json'], fileName: 'manifest.json', }), ], };
Then call rollup either via the CLI
or the API.
The configuration above will collect JSON values from given input option and
build the output file using Object.assign.
Type: (String | JSONValue) | Array[...(String | JSONValue)]
Default: []
Glob style string pattern or a JSON object or an array of a mix of those to construct a single output from.
Type: String
Default: output.json
Output filename for the merged JSON.
Type: Function
Default: (items) => Object.assign(...items)
The function responsible for merging given items.