DEV Community

Cover image for How to use npm package without build tool?
Mainendra
Mainendra

Posted on

3

How to use npm package without build tool?

How to?

  • Search for npm package skypack.dev
  • Import script using skypack url in your html page
    <script type="module">
        import { nanoid } from 'https://cdn.skypack.dev/nanoid';
        console.log('Random ID', nanoid());
    </script>
Enter fullscreen mode Exit fullscreen mode
  • Refer to index.html for sample page using nanoid.

Outuput (using sample index.html)

Page hosted on surge.sh

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay