Import
There are several ways to import nashi in your project.
ESM
If you are using bundlers like Vite or Webpack, you can manage nashi package with package manager:
pnpm add @akrc/nashi
yarn add @akrc/nashi
npm install @akrc/nashi
Then you can import nashi in following code:
import nashi from '@akrc/nashi';
If you don't have a bundler, you can import it via CDN like jsDelivr or esm.sh:
<script type="module">
import nashi from 'https://esm.sh/@akrc/nashi';
</script>
IIFE
Just add a script in your HTML files:
<script src="https://unpkg.com/@akrc/nashi@latest/dist/legacy.js"></script>
The IIFE version of nashi supports ES5, so the bundle size is 3 times larger than others, so if you can import with ESM, it's best to use ESM.
CJS
At first, download nashi via package manager:
pnpm add @akrc/nashi
yarn add @akrc/nashi
npm install @akrc/nashi
Then, import nashi as a commonjs module:
const nashi = require('@akrc/nashi');