Open ahnpnl opened 6 months ago
During JIT compilations, this is expected to fail since the transformer doesn't evaluate expressions. The templateUrl
should be a string literal.
Should we throw an error from transformer to have a more descriptive error for this case? The current error message isn’t really clear about this caveat
We should probably add an error or warning message.
@alan-agius4 I can take this one.
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When having conditional
templateUrl
like thisreplace_resources.ts
couldn't transform into proper codes (eitherrequire
orimport
)Minimal Reproduction
//... AppComponent = decorate([ Component({ selector: 'app-root', templateUrl: true === true ? './app.component.html' : './app.component.copy.html', styles: [NG_CLI_RESOURCE0, NG_CLI_RESOURCE__1] }) ], AppComponent);
// commonjs
//... exports.AppComponent = AppComponent = tslib_1.__decorate([ (0, core_1.Component)({ selector: 'app-root', templateUrl: true === true ? './app.component.html' : './app.component.copy.html', styles: [require("./app.component.css?ngResource"), require("./app.component.2.css?ngResource")] }) ], AppComponent);
Anything else relevant?
Related to this bug https://github.com/thymikee/jest-preset-angular/issues/1866