Skip to content

Latest commit

 

History

History
71 lines (46 loc) · 1.76 KB

README.md

File metadata and controls

71 lines (46 loc) · 1.76 KB

Build Files

UMD CommonJS ES Module
File router.umd.js router.cjs.js router.esm.js

Terms and import

UMD

UMD builds can be used directly in the browser via a <script> tag. The default file from jsDelivr CDN at https://www.jsdelivr.com/gh/elementumjs/router is the UMD build (router.umd.js).

  • index.html
    <script src="/node_modules/elementumjs/router/dist/router.umd.js"></script>
    <script src="index.js"></script>
  • index.js
    //...
    window['router'] = Rotuer(target, routes);

CommonJS

CommonJS builds are intended for use with older bundlers like browserify or webpack 1. The default file for these bundlers (pkg.main) is the CommonJS build (router.cjs.js).

  • index.html
    <script src="index.js"></script>
  • index.js
    const router = require("elementumjs/router");

    //...
    window['router'] = Rotuer(target, routes);

ES Module

ES Module builds are intended for use with modern bundlers like webpack 2 or rollup. The default file for these bundlers (pkg.module) is the ES Module build (router.esm.js).

  • index.html
    <script src="index.js" type="module"></script>
  • index.js
    import router from "@elementumjs/router";

    //...
    window['router'] = Rotuer(target, routes);

Download locally

Install via npm:

    npm install @elementumjs/router