library-utildeprecated

Create JavaScript library package for ES Module and CommonJS targets.

Usage no npm install needed!

<script type="module">
  import libraryUtil from 'https://cdn.skypack.dev/library-util';
</script>

README

library-util

Create JavaScript library package for ES Module and CommonJS targets.

Contents

Getting Started

one Make sure you have at least Node.js v8 and npm v5.2 installed:

node -v
npm -v

two Create package.json, install library-util and initialize project:

mkdir my-lib
cd my-lib
npm init -y
npm install --save-dev library-util
npx library-util init

three Create your library in src directory and then:

npm run build

Commands

init

Initialize project template:

npx library-util init
babel

Transpile src to es and cjs directories:

npx library-util babel

You may pass additional arguments to Babel CLI:

npx library-util babel --out-dir ../other-project/node_modules/my-lib --watch
# With --verbose option
npm start -- --out-dir ../other-project/node_modules/my-lib