anki/ts/sveltelib/export-runtime.ts
Damien Elmes 12ea482c87 expose require() instead of the svelte global
- Means add-on authors should not need to inject any code in their build
- Should be more flexible - we can export multiple libraries if we wish,
and don't have to worry about require() being clobbered by old add-ons.
2021-08-24 10:22:07 +10:00

12 lines
473 B
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
//
// Expose the Svelte runtime bundled with Anki, so that add-ons can require() it.
// If they were to bundle their own runtime, things like bindings and contexts
// would not work.
import { runtimeLibraries } from "lib/runtime-require";
import * as svelteRuntime from "svelte/internal";
runtimeLibraries["svelte/internal"] = svelteRuntime;