Library Editor
A Library embeds reusable JavaScript in your game and exposes it to Scripts through lib.ext.<alias>. It is different from a Myth Pack, which imports project resources and product tools.
Prerequisites
Show Advanced resources and open a Library. Obtain a browser-compatible classic build or a self-contained ES module and its license. Node-specific code needs a suitable browser build before import.
Import and Configure
- Use Add a Library to choose a file, or the name/link/starter entry to select another supported source.
- Check the imported source, recorded identity, Library Type, and Script alias. The alias determines its name beneath
lib.ext. - Enable the Library. Use All Libraries to inspect load order and place dependencies before their consumers.
- Run the offered syntax and verification checks. Resolve any reported errors before calling the Library from a Script.
- Save and reopen the resource, then call a small documented function from a Script in playtest.
Imported source is stored in the project and included in the exported game. The editor stores and syntax-checks code; game/playtest execution is where its runtime behavior is checked. The import size limit is 8 MiB. Live syntax checking has a lower size threshold, so use the explicit checks for larger source.
Choose a Library Type
Type: Auto-Detect selects the source format. Use Type: Classic Build for a UMD, IIFE, or global script, then set its exported Global name. Find Global inspects the source for a likely assignment; verify that the actual loaded value matches.
Use Type: ES Module for module source. Its Export selector offers Auto, All (Namespace), or Default. All exposes the module’s exports through the alias; Default selects its default export. A module with unresolved external imports is not self-contained and can leave the alias undefined in the exported game. Import a bundled module with its dependencies included and run the offered checks again.
Keep the Integration Reproducible
Record the library version and retain its license with your distributed game. Inspect an update before accepting it: a new global name or API can break the same Script alias even when the file imports successfully. Save a project backup before updating a dependency used by several Scripts.
Start with a function that takes plain values and returns a plain value. Confirm the result in Console or declared game state before integrating rendering, network calls, or asynchronous behavior.
Expected result: the enabled Library loads in order, its global or selected module export becomes available through its alias, and your Script receives the documented result. The exported game should work with the stored source without fetching the original library URL, unless that library itself makes network requests.
Troubleshooting
If syntax checking rejects module syntax, check Library Type. If an alias is undefined, check enable state, the classic Global name or module Export selection, dependency order, and runtime errors during initialization. If local playtest works but export fails, inspect unresolved imports, browser requirements, and external requests in the final target.
If a source URL cannot be reached, import a local copy through the file path instead. Keep the identity and license information accurate after replacement.
See Scripts, Myth Packs, and web publishing.
Myth Engine Documentation
