rollup-plugin-jsy-babel
v2.3.0
Published
Babel configuration for using JSY in rollup
Downloads
11
Readme
rollup-plugin-jsy-babel
Configuration for using JSY in RollupJS via Babel 6.x.
Quick Start
# optional; could also use `npm init .`
$ echo '{"private": true}' > package.json
# install devDependencies for JSY and RollupJS
$ npm install -D babel-core babel-cli rollup rollup-plugin-jsy-babel babel-preset-jsy
Add rollup.config.js
with:
import rpi_jsy from 'rollup-plugin-jsy-babel'
const configs = []
export default configs
const sourcemap = 'inline'
const plugins = [rpi_jsy()]
const external = []
// Allow Node module resolution -- https://github.com/rollup/rollup-plugin-node-resolve
/// import rpi_resolve from 'rollup-plugin-node-resolve'
/// plugins.push(rpi_resolve({main: true, browser: true, modules: true}))
const direct = [
'my_script',
].forEach(add_jsy)
function add_jsy(name) {
configs.push({
input: `code/${name}.jsy`,
output: [
{ file: `cjs/${name}.js`, format: 'cjs', exports:'named', sourcemap },
{ file: `umd/${name}.js`, format: 'umd', name, exports:'named', sourcemap },
{ file: `esm/${name}.js`, format: 'es', sourcemap },
],
plugins, external })
}
Add files
and scripts
to package.json
:
{
"files": [ "cjs/", "esm/", "umd/" ],
"scripts": {
"clean": "rm -rf ./cjs/* ./esm/* ./umd/*",
"build": "rollup --config",
"watch": "npm -s run build -- --watch",
"pretest": "npm -s run build",
"test": "true"
}
}