How to directly import an NPM module in Codepen (using unpkg)

Monarch Wadia
1 min readApr 17, 2020

--

NOTE: If you’re using this for your OWN package, please make sure you’re precompiling your NPM modules to a bundle first! Otherwise this won’t work.

Step 1: Create a pen

Step 2: Go to Settings -> JS

Step 3: Add an unpkg link as an external script with the following URL pattern: https://unpkg.com/<package-name>, then click “Save & Close”

Step 4: There is no step 4. You are DONE!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response