1 | initial version |
To relocate the node_modules directory from within the Angular project, you can follow these steps:
Here is an example of what your "build" configuration should look like:
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "../node_modules/my-project"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
}
In this example, the nodemodules directory will be relocated to the ../nodemodules/my-project directory, which is one level above the root directory of the Angular project. You can replace this path with any directory path that you prefer.