我使用的是角版本13.1.0,我已经通过ng add @nguniversal/common启用了SSR。添加此配置后,我使用ng add @angular-architects/module-federation@14.0.1添加模块联合。这增加了额外的配置来执行SSR,其中之一是从CustomResourceLoader文件中的@nguniversal/common修改server.ts。
import { CustomResourceLoader } from '@nguniversal/common/clover/server/src/custom-resource-loader'; // Not found CustomResourceLoader
import { createFetch } from '@angular-architects/module-federation/nguniversal';
...
// Without mappings, remotes are loaded via HTTP
const mappings = {
};
// Monkey Patching Angular Universal for Module Federation
CustomResourceLoader.prototype.fetch = createFetch(mappings);新版本的@nguniversal/common@13.0.2不导出CustomResourceLoader,因此不能修改它以供模块联合使用。
您知道如何使@nguniversal/common与模块联合兼容吗?
发布于 2022-02-15 16:01:47
此时(2022年2月),模块联邦的github提到了以下内容:
“由于一个错误的角度通用13,SSR目前不支持角13。然而,我们正在监测这种情况,并提供一个解决方案,一旦这些问题是固定的。”
https://github.com/angular-architects/module-federation-plugin/blob/main/migration-guide.md
https://stackoverflow.com/questions/70881661
复制相似问题