new RuntimeTemplate(): RuntimeTemplate
RuntimeTemplateCompilationstringstringRequestShortenerruntimeTemplate.assignOr(target, value): string
Returns a self-defaulting assignment, using the ||= logical assignment
operator when supported and falling back to target = target || value
otherwise. target is evaluated twice in the fallback, so it must be
side-effect free. The expression evaluates to the resulting value.
Models || only, so target must never hold a legitimate falsy value
(0, "", false) — it would be overwritten; use it for object/array defaults.
runtimeTemplate.asyncModuleFactory(__namedParameters): string
ObjectAsyncDependenciesBlockChunkGraphstringstringAsync module factory.
runtimeTemplate.basicFunction(args, body): string
Returns basic function.
runtimeTemplate.blockPromise(__namedParameters): string
ObjectAsyncDependenciesBlockChunkGraphstringModuleimport() is emitted intostringReturns expression.
runtimeTemplate.comment(__namedParameters): string
Returns comment.
runtimeTemplate.concatenation(...args?): string
Returns result expression.
runtimeTemplate.cssServerStyleRegistry(): string
stringExpression for the global registry that collects CSS server-side when there
is no DOM (SSR). An SSR host reads it from globalThis; it is keyed by the
style/chunk identifier and namespaced by output.uniqueName.
runtimeTemplate.defineEsModuleFlagStatement(__namedParameters): string
Define es module flag statement.
runtimeTemplate.destructureArray(items, value): string
Returns destructure array code.
runtimeTemplate.destructureObject(items, value): string
Destructure object.
runtimeTemplate.emptyFunction(): string
stringReturns empty function code.
runtimeTemplate.exportFromImport(__namedParameters): string
ObjectbooleanChunkGraphbooleanModuleDependencystringInitFragment<GenerateContext>[]booleanbooleanModuleModuleGraphModulestringRuntimeSpecstringExport from import.
runtimeTemplate.expressionFunction(expression, args?): string
Expression function.
runtimeTemplate.forEach(variable, array, body): string
Returns for each code.
runtimeTemplate.getBuiltinModule(request, access?): string
Reads a node builtin via process.getBuiltinModule(), guarded to stay falsy off node so universal ["node", "web"] bundles don't crash (also falsy on node <22.3).
runtimeTemplate.iife(args, body): string
Returns iIFE code.
runtimeTemplate.importStatement(__namedParameters): [string, string]
ObjectChunkGraphModuleDependencystringModuleModuleGraphModulestringbooleanbooleanReturns the import statement and the compat statement.
runtimeTemplate.isIIFE(): boolean
booleanruntimeTemplate.isModule(): boolean
booleanruntimeTemplate.isNeutralPlatform(): boolean
booleanruntimeTemplate.isUniversalTarget(): boolean
booleanWhether the bundle targets node and web at once (universal ["node", "web"] + output.module), like isUniversalTarget in WebpackOptionsApply.
runtimeTemplate.isWebLikePlatformExpression(): string
stringRuntime expression that is truthy in browser-like environments (a DOM
document or a worker self) and falsy in Node.js. Single source of
truth for branching a universal ("node-or-web") target at runtime.
runtimeTemplate.method(prop, args, body): string
Renders an object-literal method, using method shorthand when supported
and falling back to a prop: function/arrow property otherwise.
runtimeTemplate.missingModule(__namedParameters): string
Returns generated error IIFE.
runtimeTemplate.missingModulePromise(__namedParameters): string
Missing module promise.
runtimeTemplate.missingModuleStatement(__namedParameters): string
Missing module statement.
runtimeTemplate.moduleExports(__namedParameters): string
Returns the expression.
runtimeTemplate.moduleId(__namedParameters): string
Returns the expression.
runtimeTemplate.moduleNamespace(__namedParameters): string
Returns the expression.
runtimeTemplate.moduleNamespacePromise(__namedParameters): string
ObjectAsyncDependenciesBlockChunkGraphDependencystringModuleModuleimport() is emitted intostringbooleanbooleanstringModule namespace promise.
runtimeTemplate.moduleRaw(__namedParameters): string
Returns the expression.
runtimeTemplate.objectHasOwn(object, property): string
Returns an own-property check, using Object.hasOwn when supported and
falling back to Object.prototype.hasOwnProperty.call otherwise.
runtimeTemplate.optionalChaining(object, access): string
Guards an access/call on object with optional chaining when supported,
otherwise an equivalent && short-circuit. object is evaluated twice in
the fallback, so it must be side-effect free.
runtimeTemplate.renderConst(): "const" | "let" | "var"
"const" | "let" | "var"Renders return const when it is supported, otherwise let when supported, otherwise var.
runtimeTemplate.renderLet(): "let" | "var"
"let" | "var"Renders return let when it is supported, otherwise var.
runtimeTemplate.renderNodePrefixForCoreModule(mod): string
Renders node prefix for core module.
runtimeTemplate.returningFunction(returnValue, args?): string
Returning function.
runtimeTemplate.runtimeConditionExpression(__namedParameters): string
ObjectChunkGraphRuntimeSpecstring | boolean | SortableSet<string>stringRuntime condition expression.
runtimeTemplate.supportNodePrefixForCoreModules(): boolean
booleanruntimeTemplate.supportsAnalyzableEsm(): boolean
booleanruntimeTemplate.supportsArrowFunction(): boolean
booleanruntimeTemplate.supportsAsyncFunction(): boolean
booleanruntimeTemplate.supportsBigIntLiteral(): boolean
booleanruntimeTemplate.supportsConst(): boolean
booleanruntimeTemplate.supportsDestructuring(): boolean
booleanruntimeTemplate.supportsDynamicImport(): boolean
booleanruntimeTemplate.supportsEcmaScriptModuleSyntax(): boolean
booleanruntimeTemplate.supportsForOf(): boolean
booleanruntimeTemplate.supportsGenerator(): boolean
booleanruntimeTemplate.supportsLet(): boolean
booleanruntimeTemplate.supportsLogicalAssignment(): boolean
booleanruntimeTemplate.supportsMethodShorthand(): boolean
booleanruntimeTemplate.supportsModulePreload(): boolean
booleanruntimeTemplate.supportsObjectHasOwn(): boolean
booleanruntimeTemplate.supportsOptionalChaining(): boolean
booleanruntimeTemplate.supportsSpread(): boolean
booleanruntimeTemplate.supportsSymbol(): boolean
booleanruntimeTemplate.supportTemplateLiteral(): boolean
booleanruntimeTemplate.syncModuleFactory(__namedParameters): string
ObjectChunkGraphDependencystringstringSync module factory.
runtimeTemplate.throwMissingModuleErrorBlock(__namedParameters): string
Throw missing module error block.
runtimeTemplate.throwMissingModuleErrorFunction(__namedParameters): string
Throw missing module error function.
runtimeTemplate.weakError(__namedParameters): string
Returns the code.