histoire
Version:
A fast story book powered by Vite
21 lines • 1.05 kB
TypeScript
import type { PreviewRuntimeStoryFile } from './preamble.js';
/**
* Builds the emitted loader expression of one story module,
* `version => import("<module id>")`.
*
* Loaders take an optional version: re-importing the same URL is served from the
* browser's native module cache, so after a hot update the story's top-level
* code — where module-scope `onTest(...)` definitions live — would never run
* again and its tests would come back empty until a full reload.
*
* The import specifier goes through `JSON.stringify` so a module id containing
* a quote, a backslash or a backtick cannot break out of its literal.
* @param file Story file to emit a loader for.
* @param options Loader options.
* @param options.hmr Enables the cache-busting form (dev server only: a built
* app has no hot updates, and the busted URL is not analyzable by the bundler).
*/
export declare function buildStoryModuleLoader(file: PreviewRuntimeStoryFile, { hmr }?: {
hmr?: boolean;
}): string;
//# sourceMappingURL=story-module-loader.d.ts.map