Can't apply custom loader for component's 'templateUrl' since version 8
See original GitHub issue🐞 Bug report
Command (mark with an x)
- [ ] new
- [x ] build
- [x ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, the previous version in which this bug was not present was: ^7
Description
In previous versions there was an error if you tried to use any unsupported filetype for templateUrl
ERROR in Module parse failed: Unexpected token (2:55)
You may need an appropriate loader to handle this file type.
Since .svg is supported there are no error, but the file is simply loaded with raw-loader
🔬 Minimal Reproduction
Create a new project with Angular: 8.0.0-rc.5 Try to use ng-cli-pug-loader or custom-webpack builder for .pug loading.
🌍 Your Environment
Angular CLI: 8.0.0-rc.4
Node: 12.3.1
OS: win32 x64
Angular: 8.0.0-rc.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.0-rc.4
@angular-devkit/build-angular 0.800.0-rc.4
@angular-devkit/build-optimizer 0.800.0-rc.4
@angular-devkit/build-webpack 0.800.0-rc.4
@angular-devkit/core 8.0.0-rc.4
@angular-devkit/schematics 8.0.0-rc.4
@angular/cli 8.0.0-rc.4
@ngtools/webpack 8.0.0-rc.4
@schematics/angular 8.0.0-rc.4
@schematics/update 0.800.0-rc.4
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
Anything else relevant? The issue is present since .svg component template is supported - https://github.com/angular/angular-cli/commit/dfb08b95b73f3e75d0f2cd0c61f336dc86d0769a
#https://github.com/danguilherme/ng-cli-pug-loader/issues/20
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Unable to use templateUrl when upgrading Angular1 ...
I found a quite cheap solution for the issue. Just use template: require('./remote-url.component.html') instead of templateUrl: '.
Read more >Get Started with AG Grid - Angular Data Grid
In this video we detail the steps to get an application working with Angular and AG Grid Community. We show how to set...
Read more >Component testing scenarios - Angular
This guide explores common component testing use cases. ... After a few changes, the BannerComponent presents a dynamic title by binding to the...
Read more >Can you remember "Can't bind 'x' since it is not a known ...
Rule of thumb · If the element is Angular directive then check CommonModule is in place · If the element is Web Component...
Read more >Chapter 4, Understanding and Using Angular Components
Only one of template and templateUrl can be specified in a component. You cannot use both, but at least one is essential.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Almost all property of AngularCompilerPlugin is editable trough tsconfig or angular.json. I think
directTemplateLoadingshould be configurable too. The above method seems like a dirty hack.There are lot of feature request for PUG/JADE support. Since 2016 we got promises for native support https://github.com/angular/angular-cli/issues/40 (PR not merged) or trough addon system https://github.com/angular/angular-cli/issues/1886
Now in Angular 8 it’s even more difficult…
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.