Angular, Nx lib style import when building for SSR

Discussão em 'Angular' iniciado por Marco Bono, Janeiro 27, 2025.

  1. Marco Bono

    Marco Bono Guest

    I'm trying to run target "serve-ssr" with executor @nguniversal/builders:ssr-dev-server on my-app, but I'm getting the "Can't find stylesheet to import." error in libs which are imported by my-app.

    my-app has these build options to include styles:

    "stylePreprocessorOptions": {
    "includePaths": ["apps/my-app/src/styles"]
    }


    And I have no error when i run target "serve" with executor @angular-devkit/build-angular:browser by itself.

    My question is: since the imported libs don't have a declared "build" target in their project.json, how do i tell them to also use the same stylePreprocessorOptions as my-app? Do i need to specify them in a build (and eventually a server target) target for every lib?

    I've tried fiddling around with libs project.json files and adding the styles paths in my-app's compilerOptions.paths but nothing worked. I'm still new to SSR, especially in an Nx monorepo context and haven't been able to find anything that works, I always get the same "Can't find stylesheet to import." error, so I'm guessing I'm missing something in the libs config but I don't know what.

    Continue reading...

Compartilhe esta Página