Nx assets path ambiguity in development vs build mode

13 views Asked by At

I'm writing a report feature using Nx + nestjs. I have to put pictures (logos etc.) in this generated document.

The ambiguity I face is in accessing assets path. Below works in one environment but not in other:

1. doc.image("./assets/logo.jpg") // <- this work in builds
2. doc.image("./apps/service/src/assets/logo.jpg")  // this works in dev (nx run service:serve)

Project.json already has "assets": ["apps/service/src/assets"]

and assets directory get copied to dist folder.

But I can only have line 1 or line 2 in the code. How can I solve this to run correctly in both development (hot reload) and deployment?

Thanks in advance!

0

There are 0 answers