misleading error message: Cannot use Javascript or TypeScript file in styleUrl
#12693
Labels
area: ngtools/webpack
freq1: low
Only reported by a handful of users who observe it rarely
severity1: confusing
type: bug/fix
Milestone
Bug Report or Feature Request (mark with an
x
)When the
templateUrl
option in a component is accidentally pointing at a typescript file, the error message says that there's an issue in astyleUrl
option somewhere, which causes confusion and way more time tracking down the issue than should be given the simple-typo nature of the mistake.Command (mark with an
x
)Versions
Repro steps
ng serve
fails withERROR in Cannot use JavaScript or TypeScript file in styleUrl
.Note that the error message says the issue is in a
styleUrl
option somewhere, when the actual issue is in thetemplateUrl
option.The log given by the failure
Desired functionality
ERROR in Cannot use JavaScript or TypeScript file in templateUrl or styleUrl
I lost about 45 minutes trying to figure out which
styleUrls
declaration had the typo, and eventually figured it out due to being given a circular dependency warning on a file to itself.Mention any other details that might be useful
angular-cli/packages/ngtools/webpack/src/resource_loader.ts
Line 52 in 8bbba9d
The text was updated successfully, but these errors were encountered: