NPM
Luna Park can use packages from the npm registry, the largest library of JavaScript code. Their functions become logic nodes, and Vue component packages add components to the editor.
Install a package
- Click Libraries in the top bar, then Install packages.
- In the Packages tab, search for a package by name.
- Select it and click Scan package: Luna Park reads its type definitions to find what it exports.
- Click Install.
The Installed tab lists the packages of the project.
Sub-paths
Some packages expose features under a sub-path (for example date-fns/locale). Once a package is installed, open the ... menu next to Package installed and enter the Child package name.
Use a package
Each exported function becomes a node, found in the node search under the package's name (package/<name>/...). Inputs and outputs follow the function's TypeScript types.
Packages that export Vue components also add those components to the editor.
How it works
- In the editor, packages are loaded from the esm.sh CDN.
- In the exported app, they are added to the project's
package.jsonand installed like any dependency.
WARNING
Pick packages that ship TypeScript types and run in the browser: without types, Luna Park can't tell which nodes to create, and the editor runs your logic in the browser.
To remove a package, open it and click Uninstall.