UNPKG

@lynx-js/runtime-wrapper-webpack-plugin

Version:

Use runtime wrapper which allow JavaScript to be load by Lynx.

59 lines (58 loc) 1.78 kB
import type { BannerPlugin, Compiler } from 'webpack'; /** * The options for RuntimeWrapperWebpackPluginOptions * * @public */ interface RuntimeWrapperWebpackPluginOptions { /** * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.targetSdkVersion} */ targetSdkVersion: string; /** * Include all modules that pass test assertion. * * @defaultValue `/\.js$/` * * @public */ test: BannerPlugin['options']['test']; /** * There are two types of banners: script(for app-service) and bundle(for js-render). You can decide to use which banner by the filename. * * @defaultValue `() => 'script'` * * @public */ bannerType: (filename: string) => 'script' | 'bundle'; /** * The variables to be injected into the chunk. */ injectVars?: ((vars: string[]) => string[]) | string[]; /** * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.experimental_isLazyBundle} */ experimental_isLazyBundle?: boolean; } /** * RuntimeWrapperWebpackPlugin adds runtime wrappers to JavaScript and allow to be loaded by Lynx. * * @public */ declare class RuntimeWrapperWebpackPlugin { private readonly options; constructor(options?: Partial<RuntimeWrapperWebpackPluginOptions>); /** * `defaultOptions` is the default options that the {@link RuntimeWrapperWebpackPlugin} uses. * * @public */ static defaultOptions: Readonly<Required<RuntimeWrapperWebpackPluginOptions>>; /** * The entry point of a webpack plugin. * @param compiler - the webpack compiler */ apply(compiler: Compiler): void; } export { RuntimeWrapperWebpackPlugin }; export type { RuntimeWrapperWebpackPluginOptions };