Nodejs implements the corresponding js/css/img path for production or development environment references

how does nodejs implement if the path referenced by the development environment is dist/css/xx.css

        build/css/xx.css

the project uses ejs templates and express frameworks
how should such requirements be implemented? thank you

Mar.31,2021

there is something called environment variable.
the most direct way is to change the path referencing css to process.env.CSS_PATH +'/ css/xx.css'

.

then use CSS_PATH=dist npm start to launch
use CSS_PATH=build npm start to launch

when the production environment is executing.
Menu