rollup-plugin-generate-package-json
Generate package.json
file with packages from your bundle using Rollup.
Why
This plugin is useful when you have a lot of packages in your current package.json
and want to create a lean one with only packages from your generated bundle, probably for deployment.
Installation
npm install rollup-plugin-generate-package-json --save-dev
yarn add rollup-plugin-generate-package-json -D
Usage
import path from 'path'
import generatePackageJson from 'rollup-plugin-generate-package-json'
const basePackageJson = {
scripts: {
start: 'node app.js'
},
dependencies: {},
private: true
}
export default {
input: 'src/main.js',
output: {
file: 'dist/app.js',
format: 'cjs'
},
plugins: [
generatePackageJson({
inputFile: path.resolve(__dirname, '../package.json'),
outputFolder: path.resolve(__dirname, '../dist'),
baseContents: basePackageJson
})
]
}
License
MIT