Client-side packages are npm packages that are made available to the browser for your Pen. CodePen supports them by helping you detect them, automatically adding them to your package.json file, then linking them up on all your pages as a <script type="importmap">.
Basic Usage
Imagine the venerable uuid package on npm. Using it is simple, and its docs show many examples.
import { v4 } from 'uuid';
v4();Code language: JavaScript (javascript)
The 'uuid' bit above is what the web platform calls a “bare module name” or a “bare module specifier”. On projects that use Node.js, this typically means installing this package and a bundler finding it within a node_modules folder. But CodePen does it a bit differently.
Bare module specifiers are also part of how import maps work, and CodePen takes advantage of that. In the example code above, the CodePen Compiler will see that bare module specifier and scaffold a package.json file for you with the latest version of that package in it.

This package.json file will automatically be inserted into all .html files for you in the Build Output.

So you don’t need to manually use import maps; CodePen handles it for you. You can include your own import maps, and CodePen will respect those by combining the automatically generated import map with your import map, honoring your choices first.
Potential Package Version Issues
Package interdependencies can be complicated!
Here’s an example of some dependencies in a package.json file.
{
"dependencies": {
"liquid-glass-react": "1.1.1",
"react": "19.1.0",
"react-dom": "19.1.0"
}
}Code language: JSON / JSON with Comments (json)
For whatever reason, react-liquid-glass doesn’t work with React 19.1.0, and must be updated to 19.1.1. Thankfully, have the control to do that with your own package.json file (just update the numbers!).
{
"dependencies": {
"liquid-glass-react": "1.1.1",
"react": "19.1.1",
"react-dom": "19.1.1"
}
}Code language: JSON / JSON with Comments (json)
In a similar vein, sometimes packages have their own dependencies that don’t match what you’ve specified. The CDN we map to, esm.sh, allows you to specify versions of the dependencies of other packages (their docs). So the above issue could have also been solved like this:
{
"dependencies": {
"liquid-glass-react": "1.1.1?deps=react@19.1.0,react-dom@19.1.0",
"react": "19.1.0",
"react-dom": "19.1.0"
}
}Code language: JSON / JSON with Comments (json)
But the above is non-standard package.json behavior; it just happens to work with the way the CodePen compiler produces import maps. A standard-behavior way would be to include your own import map with the override:
<script type="importmap">
{
"imports": {
"react": "https://esm.sh/liquid-glass-react@1.1.1?deps=react@19.1.0,react-dom@19.1.0"
}
}
</script>Code language: HTML, XML (xml)
Your import map will override CodePen-injected import maps, which should fix the issue.
Resetting Package Versions
If you simply delete the package.json file, it will regenerate it with the most recent npm versions of all packages found and used. This can fix issues that can come up with package versions.