
包详细信息
@vercel/microfrontends
Defines configuration and utilities for microfrontends development
自述文件

更新日志
@vercel/microfrontends
1.4.0
Minor Changes
- b31a76c: - Improve
PrefetchCrossZoneLinksProvider
performance.- Stops components using this context from rerendering every time
prefetchHref
is called on an unseenhref
. - Batches multiple prefetch calls together before causing a new render.
- Improve
MicrofrontendConfigClient
caching.- Reuses clients when calling
MicrofrontendConfigClient.fromEnv()
with the same parameters as a previous call. This improves the hit rate of the path cache when there aren't dynamic paths. - Caches the
hasDynamicPaths
check so that it doesn't need to be recalculated for each use of the hook. - When the promise for the server-fetched config resolves, it stores a cached copy of that directly in a new variable so that future invocations of
useClientConfig()
can have the correct config in their initial render. - Adds a
regexpCache
to cache the resulting regex for each path, to avoid callingpathToRegexp
in most cases beyond the initial few links.
- Reuses clients when calling
- Remove the custom
@vercel/microfrontends
Image
component.- The wrapper around Next.js
Image
is no longer needed, as the vercel proxy now handles image optimisation request routing for microfrontends. - If you are currently importing
{ Image } from '@vercel/microfrontends/next/client'
you can replace this withImage from 'next/image'
.
- The wrapper around Next.js
- Use
defineServer
instead of custom webpack EnvironmentPlugin when the version of Next.js is new enough to support it.- vercel/next.js#79225 added support to Next.js for defining server-only compile-time constants independent of the bundler.
- Like
compiler.define
, this allows users to create compile-time constants both Turbopack and webpack from a single API.compiler.defineServer
instead only makes these constants available for server or edge environments, not the client environment.
- Like
- The new behaviour is used by default when the version of Next.js is new enough to support it. Otherwise the custom webpack EnvironmentPlugin is used.
- Optionally, you can specify
preferWebpackEnvironmentPlugin
. This will use the legacywebpack.EnvironmentPlugin
instead of Next.js'sdefineServer
option, even when Next.js is new enough to support it.
- vercel/next.js#79225 added support to Next.js for defining server-only compile-time constants independent of the bundler.
- Remove support for
projectId
inmicrofrontends.json
.projectId
was deprecated in a previous release. This release removes support for the field entirely.- If you are still using
projectId
, see the previous release notes inCHANGELOG.md
for removing it.
- Stops components using this context from rerendering every time
1.3.0
Minor Changes
- 8b5f62d: Replace the need to add a
.well-known
endpoint for flagged paths. Instead, just add/.well-known/vercel/microfrontends/client-config
to your middleware matcher. Note that the middleware is only required if you have flagged paths.
1.2.0
Minor Changes
653c9d2: Improved local development proxy, simplified config, Vite support, more detailed error messages, testing, and more!
This release has some minor breaking changes. We try not do this, but at this stage of the project (where we have a relatively small amount of users, each who we're working closely with), we are leaning more towards breaking things and providing clear upgrade instructions so we can move a little quicker. Please let us know if you have concerns with this approach!
The
fromApp
parameter to your call torunMicrofrontendsMiddleware
(in yourmiddleware.ts
file) is gone! Please delete the parameter.Your code will fail to compile until you delete the parameter.
The
development.localPort
field in each application in yourmicrofrontends.json
file is renamed todevelopment.local
. All you need to do is deletePort
from the field name and it will continue working exactly as before!The new field has improved support where you can add a full protocol/host/port if you need (for example,
https://my.localhost.me:8080
), but works the same as before if you just specify a port.If the application name in your
microfrontends.json
matches the Vercel project name, theprojectId
field is no longer required, please remove it! We would like to deprecate theprojectId
field in the future. If you have any concerns, please reach out.projectId
is annoying to set up so we hope this simplifies things!- The Vercel project name should ideally match the application's
package.json
name. If this is not the case, you will need to set thepackageName
field to thename
from thepackage.json
file. This is needed for the local development proxy to work. - Visit https://vercel.com/docs/microfrontends/troubleshooting for test utilities to validate the microfrontends setup for your application. If you have any issues with these changes, please reach out! We are here to help.
1.1.0
Minor Changes
- 844006a:
- Add experimental support for SvelteKit.
- Add experimental support for Vite and React Router.
- Improved inference for NX monorepos.
- Support additional path syntax,
/:path(a|b|c)
,/:path((?!a|b|c).\*)
, and/some-:hash.js
- Fix the next/server import to avoid potential import issues for peer dependencies.
- Disallow deprecated fields in microfrontends config by default.
- Improvements/fixes to local development proxy.
- Add
supportPagesRouter
option that corrects/\_next/data
requests to the correct child for Next.js Pages Router.
1.0.0
Major Changes
- 37765c3: Initial public release
Minor Changes
- b559d60: Add back Vercel specific rewrites in local package for preview and local development without the proxy
- 00ec734: Add back next config rewrites to deployed apps