JSLab feature notes: one docs page, explained. Today: npm packages .
A scratchpad without packages is a calculator. Here's how JSLab, a JavaScript & TypeScript scratchpad for macOS, handles them.
Install once, every tab can import it
⌘I (or Tools → NPM Packages…, or the activity bar) opens the package sheet. Search the registry as you type and click Add , or type name@version and press Return: exact versions and ranges both work.
import { nanoid } from " nanoid " ; nanoid (); // Auto Log shows a fresh id on every run
Enter fullscreen mode
Exit fullscreen mode
Packages install into one project that every tab shares, so every other tab can import a package you add in one tab straight away, without restarting JSLab.
Types and autocomplete
The editor reads the types of what you install, so imports autocomplete and type-check. Inside an import's quotes, installed packages are suggested as you type.
A package that doesn't ship its own types needs its @types package.…