From d0ea4a611e1826b6c2a3dd1d9081df1b51dc37e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojtech=20Ma=C5=A1ek?= Date: Mon, 14 Aug 2023 20:34:53 +0200 Subject: [PATCH] refactor(ng-universal-express): icon loader path on fb function --- projects/ng-universal-express/src/app/app.config.ts | 13 ++++++++++++- .../src/app/icon-load.ssr.strategy.ts | 2 -- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/ng-universal-express/src/app/app.config.ts b/projects/ng-universal-express/src/app/app.config.ts index edd359999..cfc239bf6 100644 --- a/projects/ng-universal-express/src/app/app.config.ts +++ b/projects/ng-universal-express/src/app/app.config.ts @@ -10,6 +10,8 @@ import { tmdbReadAccessInterceptor, } from 'angular-movies'; import { requestTimingInterceptor } from './http-timing.interceptor'; +import { join } from 'node:path'; +import { cwd } from 'node:process'; const serverConfig: ApplicationConfig = { providers: [ @@ -29,7 +31,16 @@ const serverConfig: ApplicationConfig = { provideTmdbImageLoader(), provideFastSVG({ url: (name: string) => - `dist/projects/movies/browser/assets/svg-icons/${name}.svg`, + join( + cwd(), + 'dist', + 'projects', + 'movies', + 'browser', + 'assets', + 'svg-icons', + `${name}.svg` + ), svgLoadStrategy: IconLoadStrategySsr, }), { diff --git a/projects/ng-universal-express/src/app/icon-load.ssr.strategy.ts b/projects/ng-universal-express/src/app/icon-load.ssr.strategy.ts index 81744d978..93142f551 100644 --- a/projects/ng-universal-express/src/app/icon-load.ssr.strategy.ts +++ b/projects/ng-universal-express/src/app/icon-load.ssr.strategy.ts @@ -7,8 +7,6 @@ import { Observable } from 'rxjs'; @Injectable() export class IconLoadStrategySsr implements SvgLoadStrategy { load(url: string): Observable { - // eslint-disable-next-line unicorn/prefer-module - console.log('~~ IconLoadStrategySsr', __dirname, url); return new Observable((observer) => { readFile(resolve(url), { encoding: 'utf8' }, (error, data) => { if (error) {