Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Latest commit

 

History

History
64 lines (49 loc) · 1.42 KB

File metadata and controls

64 lines (49 loc) · 1.42 KB

Package reference use of rollup-plugin-jsy-lite

Configuration for using JSY in RollupJS without Babel.

NPM Install
# optional; could also use `npm init .`
$ echo '{"private": true}' > package.json

# install devDependencies for JSY and RollupJS
$ npm install -D \
    rollup rollup-plugin-jsy-lite
Add rollup.config.js with:
import rpi_jsy from 'rollup-plugin-jsy-lite'

const configs = []
export default configs


const sourcemap = 'inline'
const plugins = [rpi_jsy()]
const external = []


import pkg from './package.json'
configs.push({
  input: 'code/index.jsy',
  output: [ 
      pkg.main && { file: pkg.main, format: 'cjs', exports:'named', sourcemap },
      pkg.browser && { file: pkg.browser, format: 'umd', name: pkg.name, exports:'named', sourcemap },
      pkg.module && { file: pkg.module, format: 'es', sourcemap },
    ].filter(Boolean),
  plugins, external })
Add library exports to package.json :
{
  "main": "cjs/index.js",
  "module": "esm/index.mjs",
  "browser": "umd/index.js",
}
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"
  }
}