Reputation: 18801
Background: I will be building 40+ locales of an applications and pre-rending all the pages to static html.
To do this I need access to every AppServerModuleNgFactory
.
1- Can I call ng build from from @angular/cli
package in a file called build.ts
w/o using node exec
?
From this:
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');
to something better like this:
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`);
Upvotes: 3
Views: 782