I'm facing an issue with loading an external css file in different environment files. My setup includes two environments: development and production. Loading the css file locally works fine in development mode, but not in production mode.
environment.dev.ts
require("style-loader!./../assets/style.css");
environment.prod.ts
require("style-loader!http://abc/style.css");
This results in the following error:
Can't resolve ''
Any suggestions on how to make it work with a URL?
Thanks!
UPDATE
Following Milad's suggestion, I attempted to use a dynamic href link:
<link [attr.href]="getCss()" type="text/css">
function getCss(): string {
return this.mode === 'dev' ?
'assets/style.css':
'http://abc/sprite.css';
}
However, this led to the error:
unsafe value used in a resource URL context