Closed giniedp closed 4 years ago
a workaround is to change the initialisation of the AngularCompilerPlugin
as follows
new AngularCompilerPlugin({
platform: 0,
mainPath: config.isTest
? config.frontend.entry.test
- : config.frontend.entry.main,
+ : undefined,
tsConfigPath: config.isTest
? config.frontend.tsconfigTestFile
: config.frontend.tsconfigAppFile,
skipCodeGeneration: !config.isAot,
sourceMap: true,
forkTypeChecker: true,
directTemplateLoading: false,
compilerOptions: {
fullTemplateTypeCheck: true,
strictInjectionParameters: true,
strictTemplates: false,
enableIvy: config.isIvy
}
})
this works. Is this intended behavior?
Chiming in @clydin as I donβt think that this is supported.
why shouldn't it be supported?
This should be supported and was currently not functional in JIT mode due to an error with legacy string-form lazy route discovery. The referenced PR will correct the issue.
Also when using the Ivy compiler in 9.0+, AOT mode is recommended for all build types including both development and production. Performance has been improved and AOT provides far more comprehensive error checking especially for component templates.
@clydin thank you very much for the fix and info
yes, build performance has improved and for small code bases it makes sense to use AOT in dev mode. For large projects the initial build time is still much higher, in our case its 1 minute vs 2 minutes.
Further AOT in watch mode does not work in our case, so i can not compare. Initial build is fine, but re-build fails with
Error: Errors parsing template: Invalid ICU message. Missing '}'. ("
I assume it is caused and fixed by the referenced PR?
The issue also occurs here https://github.com/danguilherme/ng-cli-pug-loader/issues/31
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
π Bug report
Having the
AngularCompilerPlugin
in a custom steup instantiated like thisand a webpack rule for
.pug
templatesthe templates are processed by the
ngtc
compiler without being transpiled to.html
. The compiler fails when when template contains certain syntax with following errorivy
enabled andaot
disabledivy
andaot
enabledthis template would fail
but this template would not. Interestingly the application the renders correctly, as if the pug is transpiled at a later stage
Adding a
console.log
at node_modules/compiler-cli/src/ngtsc/annotations/src/component reveals thatpug
content is processed whenaot
is offhtml
content is processed whenaot
is on㪠Minimal Reproduction
Repo is here https://github.com/giniedp/angular-9-custom-pug-setup
π Your Environment