1.0.2 • Published 5 months ago

sample-uit-agr-app v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

sample-uit-agr-app

This shows how to distribute an ES6 library using Babel and rollup.

  • package.json#module points to the raw ES6 code for modern browser consumption
  • package.json#main points to legacy browser/node support and CommonJS modules.

Under the hood, it uses Babel and babel-runtime for legacy browser/Node.js support. babel-runtime (actually the transform-runtime plugin) polyfills only what the library uses and does so in a way that doesn't conflict with other versions of Babel. This is perfect for libraries.

We use rollup only to create the UMD bundle for JSFiddle consumption.

Building

npm run build
// then publish to npm...

Installation

npm install sample-uit-agr-app // from an app

Consumption

// Web, webpack consumption, modern browsers only
import foo from "sample-uit-agr-app";
// Web, webpack consumption, legacy browser support
import foo from "sample-uit-agr-app/dist/legacy/index";
// Node.js
const foo = require("sample-uit-agr-app");

JSFiddle support: dist/legacy-umd/index.js is a UMD bundle that can be put behind a CDN and loaded via a <script> tag. For example, here it is via jsdeliver.com, and here it is in a fiddle.

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago