rollup-plugin-json
Convert .json files to ES6 modules:
import { version } from './package.json';
console.log( `running version ${version}` );
import pkg from './package.json';
console.log( `running version ${pkg.version}` );
Installation
npm install --save-dev rollup-plugin-json
Usage
import json from 'rollup-plugin-json';
export default {
input: 'src/main.js',
output: {
file: 'dist/bundle.js',
format: 'iife'
},
plugins: [
json({
include: 'node_modules/**',
exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ],
preferConst: true,
indent: ' ',
compact: true,
namedExports: true
})
]
};
License
MIT