More restrictive templateUrl and styleUrls regex
Hi,
In my code I'm currently dynamically creating component metadata and it's being replaced. A more restrictive regex would avoid that.
/templateUrl\s*:\s*(['"`].*['"`])/g
/styleUrls\s*:(\s*\[.*['"`]+.*\])/g
Theses would be enough for me. Introducing quote allows it to differentiate when we are using programmatic code like referencing to a variable and when we are statically setting an url through a string.
But maybe including '.html' or even checking for a preceding @Component may be even better. Dunno if it's worth the trouble.
I'm facing similar problem when using it with an hybrid ng1/ng4 app. It replaces templateUrl occurrences on ng1 templates, which it is unwanted behavior for this app.
Since it is an angular2-template-loader it would be better if it checked the occurrence within a @Component declaration
Also running into this issue with a hybrid app, where an Angular component needs to pass a templateUrl to an AngularJS component. Our AngularJS code uses it's existing build process to put all the templates in $templateCache keyed by their path, so checking for html wouldn't help, but an @Component check would fix it. My current workaround is to assign the string to a variable and then assign the variable to templateUrl.