README
pkg-bundler
Zero-config rollup bundler for npm packages built with babel
npm i -D pkg-bundler
Add a .babelrc
file for your package.
{
presets: [
[ 'env', { modules: false } ],
'react'
]
}
Add a main
and optional module
field to your package.json
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Add a prepare
script to your package.json
"scripts": {
"prepare": "pkg-bundler src/index.js"
}
When publishing your package, pkg-bundler
will use Rollup to create the dist bundles
Motivation
Setting up similar build configs for multiple packages is a lot of overhead. This is meant to reduce the amount of custom config added to any npm package. This is a sort of react-scripts-like package for publishing packages.