单个Spa spa angular i18n文件未在Angular 9中加载

问题描述

我正在使用单个spa创建微型前端角度应用程序。如何从资源文件夹中加载i18n文件

我已遵循以下指示: https://single-spa.js.org/docs/ecosystem-angular/

Angular版本:9.1.12

单个水疗中心:4

单个spa角度:4.4.2

enter image description here

我们是否需要在webpack中添加一些其他配置,以便从资产文件夹中加载i18n文件

解决方法

在将单Spa库安装到应用程序时,将生成single-spa / assets-url.ts。您需要在组件中导入asset-url.ts并通过assetUrl方法传递i18n文件的路径,以便在运行应用程序时可以使用它。