'Is it possible to separate build files with nx build node?
I have a node js project with nx workspace and my problem is that my routes for download and upload is with path for example const filePath = path.join(__dirname, '../../templates', fileName)
. When I run
nx run build
nx combines all files into one single main.js file and thats ruin my paths and my app no longer finds template because its only one folder up not 2. What should I do to tell nx build to build my app like normal and not combining all my files into single file?
Solution 1:[1]
I have made a custom script:
"start": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
"nodemon -e ts,graphql --exec \"nx run server-authentication:start-nodemon\""
],
"cwd": "apps/server/authentication",
"parallel": false
}
},
"start-nodemon": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
"nx run server-authentication:ts-build",
"node ../../../../dist/apps/server/authentication/src/index.js"
],
"cwd": "apps/server/authentication",
"parallel": false
}
},
"ts-build": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
"tsc -p tsconfig.app.json",
"tsc-alias -p tsconfig.app.json",
"ncp src/schema ../../../../dist/apps/server/authentication/src/schema",
"ncp .env ../../../../dist/apps/server/authentication/src/.env"
],
"cwd": "apps/server/authentication",
"parallel": false
}
},
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mj Ebrahimzadeh |