如何从节点调用角度/ cli命令?

问题描述 投票:2回答:1

背景:我将构建一个应用程序的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`);
node.js angular angular-cli angular-universal platform-server
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.