@tscircuit/internal-dynamic-import
v0.0.7
Published
Type-safe dynamic imports for selected tscircuit packages via jscdn and fallback to jsDelivr
Downloads
39,357
Readme
@tscircuit/internal-dynamic-import
This module simplifies dynamically importing tscircuit modules, especially when you always want to use the latest version.
It is also approximately type-safe, meaning we package bundled declaration types for a recent version of the supported modules here while leaving the runtime implementation remote.
import importer from "@tscircuit/internal-dynamic-import"
async function main() {
const { convertSoupToGerberCommands } = await importer("circuit-json-to-gerber")
// Import a specific version
const { CircuitJsonToKicadProConverter } = await importer(
"[email protected]",
)
// ...
}Runtime imports try jscdn first through https://jscdn.tscircuit.com/.../+esm
and fall back to https://esm.run/... if the jscdn import fails. Omitting a
version uses latest; adding @... preserves the requested version/tag.
