远程模块可以通过多种方式导入。
使用 React.lazy
和 React.Suspense
使用 next/dynamic
导入远程模块会导致 hydration error(重新水合错误)。
Named Exports require a mocked default
be returned to React.lazy
which expects only default exports.
Eager imports work as well, but it is reccomneded to use dynamic imports when possible to avoid large upfront network transfors or requests
In some cases, you may just want to load a remote module on the client.
For example, if your remote does not provide a commonjs and browser build target.
Node requires a remoteEntry in commonjs format, you cannot provide a browser designated remote to a Server.