背景:我将构建一个应用程序的40多个语言环境,并将所有页面预先呈现为静态html。
为此,我需要访问每个AppServerModuleNgFactory
。
1-我是否可以使用节点@angular/cli
从名为build.ts
的文件中的exec
包中调用ng build?
来自此:
exec(ng build --output-path=dist/apps/portfolio/fr-CA -prod --aot --bh=/fr-CA/ --app=portfolio --i18n-file=./apps/portfolio/i18n/messages.fr-CA.xlf --i18n-format=xlf --locale=fr-CA;)
const { AppServerModuleNgFactory} = require('dist/apps/portfolio-server/fr-CA/main.bundle.js');
为了[[更好]:
const { AppServerModuleNgFactory} = await ng.build(`
-prod
--aot
--bh=/fr-CA/
--app=portfolio
--i18n-file=./apps/portfolio/i18n/messages.fr-CA.xlf
--i18n-format=xlf
--locale=fr-CA`);