Skip to content

Public API Contract ​

This document defines the compatibility surface that vite-plugin-federation keeps stable for the 1.x release line.

Compatibility Policy ​

  • Patch and minor releases in 1.x must preserve existing public option names, runtime export names, manifest schema semantics, devtools contract fields, and MFV-* error-code meanings.
  • Minor releases may add new options, optional manifest fields, runtime helpers, devtools fields, or error codes when existing consumers can ignore them safely.
  • Deprecations must keep the old behavior working for the rest of the 1.x line unless a security or upstream runtime issue makes that impossible. Removing or changing a documented contract requires a new major version.
  • Internal virtual modules, generated chunk filenames, private debug state not documented here, and implementation details under src/ are not public contracts.

Package And Engine Contract ​

The published package keeps these entry points stable:

  • vite-plugin-federation
  • vite-plugin-federation/runtime

The v1.x support floor is:

  • Node >=20.19.0
  • Vite ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0

Dropping support for Node >=20.19.0 or any currently declared Vite major in that peer range is a major-version change unless a security or upstream end-of-life issue requires a documented exception.

Plugin Options ​

The package root exports the default plugin function and the named federation function. It also exports the public ModuleFederationOptions and PluginManifestOptions types.

The ModuleFederationOptions field names and current defaults are part of the v1.x contract:

OptionCompatibility commitment
nameRequired public app/container name.
filenameBrowser remote entry filename; default remains remoteEntry-[hash].
varFilenameAdditional var-style entry filename for legacy hosts.
exposesString and object expose forms, including css.inject and dontAppendStylesToHead.
remotesManifest URL strings and object remote configs.
sharedArray and object forms, including singleton, strict version, host-only, and suffix matching controls.
manifestboolean or PluginManifestOptions; default remains enabled.
dtsboolean or DTS options; TypeScript projects keep automatic enablement unless disabled.
devboolean or dev options for devtools, live reload, type hints, hot types, and remote HMR.
compatboolean or compatibility options; OriginJS compatibility remains enabled by default.
shareStrategyRuntime share strategy; default remains version-first.
shareScopeDefault share scope; default remains default.
publicPathPublic path for generated manifest asset URLs.
bundleAllCSSAdds CSS assets to expose manifest entries; default remains false.
runtimePluginsRuntime plugin import list passed to the Module Federation runtime.
targetweb or node; SSR builds continue to auto-detect node.
hostInitInjectLocationHost runtime init injection location; default remains html.
moduleParseTimeoutTotal module parse timeout in seconds; default remains 10.
moduleParseIdleTimeoutOptional idle parse timeout in seconds.
virtualModuleDirVirtual module directory option; slash rejection remains MFV-001.
libraryPassed through for Module Federation compatibility.
runtimePassed through for Module Federation compatibility.
getPublicPathPassed through for Module Federation compatibility.
implementationRuntime implementation override.
ignoreOriginOrigin handling compatibility flag.

Runtime Exports ​

The vite-plugin-federation/runtime function export names are part of the v1.x contract:

  • getInstance
  • createFederationInstance
  • createServerFederationInstance
  • registerPlugins
  • registerGlobalPlugins
  • registerRemotes
  • registerShared
  • getRemoteEntry
  • getRemoteInfo
  • loadScript
  • loadScriptNode
  • loadShare
  • loadShareSync
  • loadRemote
  • preloadRemote
  • fetchFederationManifest
  • registerManifestRemote
  • registerManifestRemotes
  • loadRemoteFromManifest
  • refreshRemote
  • warmFederationRemotes
  • resolveFederationManifestAssetUrl
  • findFederationManifestExpose
  • collectFederationManifestExposeAssets
  • collectFederationManifestPreloadLinks
  • createFederationManifestPreloadPlan
  • verifyFederationManifestAssets
  • clearFederationRuntimeCaches
  • getFederationDebugInfo
  • getFederationRuntimeScopeDebugInfo
  • createFederationRuntimeScope

Exported TypeScript types from vite-plugin-federation/runtime are also public. Existing type names, required fields, and return shapes must remain assignable for 1.x; additive optional fields are allowed.

Manifest Schema ​

Manifest-enabled builds emit mf-manifest.json, mf-stats.json, and mf-debug.json artifacts. The v1 schema contract is schemaVersion: "1.0.0" and is documented in manifest-protocol.md.

Compatibility rules:

  • A 1.0.0 runtime accepts missing schemaVersion as a legacy manifest.
  • A 1.0.0 runtime accepts same-major 1.x.y manifests when required runtime fields remain usable.
  • A 1.0.0 runtime rejects future major manifests with MFV-004.
  • Patch and minor schema changes in major version 1 must be additive.

Devtools Contract ​

The devtools browser global and dev server payload are versioned as contract 1.0.0 in devtools-runtime-contract.md.

These names remain stable for 1.x:

  • window.__VITE_PLUGIN_FEDERATION_DEVTOOLS__
  • /<base>/__mf_devtools
  • vite-plugin-federation:debug
  • vite-plugin-federation:remote-update
  • vite-plugin-federation:remote-style-update
  • vite-plugin-federation:remote-types-update

New fields and events may be added, but existing top-level fields and event meanings must remain compatible.

Error Codes ​

The MFV-* code meanings are stable for 1.x:

CodeMeaning
MFV-001Plugin configuration error.
MFV-002Alias conflict between a shared key and another resolver.
MFV-003Shared dependency miss, fallback, or strict-singleton conflict.
MFV-004Manifest fetch or validation failure.
MFV-005Missing expose or unsupported legacy remote format.
MFV-006SSR remote entry missing for a Node-target load.
MFV-007Dynamic import rewrite warning or unsupported legacy from.

New codes may be added for new failure classes. Existing codes must not be reused for unrelated failure semantics.

Released under the MIT License.