init(options: InitOptions): void
Vmok
modules at runtime.loadRemote(id: string)
Type: loadShare(pkgName: string, extraOptions?: { customShareInfo?: Partial<Shared>;resolver?: (sharedOptions: ShareInfos[string]) => Shared;})
Gets a share
dependency. When there is a share
dependency in the global environment that meets the requirements of the current host
, the existing dependency that meets the share
conditions will be reused first. Otherwise, its own dependency will be loaded and stored in the global cache.
This API
is generally not called directly by the user, but is used by the build plugin to transform its own dependencies.
Example
If multiple versions of shared are set, the loaded shared with the highest version will be returned by default. This behavior can be changed by setting extraOptions.resolver
:
Through preloadRemote
, you can start preloading module resources at an earlier stage to avoid waterfall requests. What can preloadRemote
preload:
remote
's remoteEntry
remote
's expose
remote
's synchronous or asynchronous resourcesremote
's dependent remote
resourcesinfo: Please set force:true
with caution!
If force: true
is set, it will overwrite the registered (and loaded) modules, and automatically delete the cache of the loaded modules (if they have been loaded), and output a warning in the console to inform that this operation is risky.