I faced a problem that I couldn't use vercel environment variables with a deployed angular app. I used to write my sensitive information in an env file while writing backend code and I forgot that browsers don't support the process
module. So I searched for a while and got the result I want by following these steps:
- install the next package:
npm install --save-dev @angular-builders/custom-webpack
- open
angular.json
and use"builder": "@angular-builders/custom-webpack:browser"
instead of"builder": "@angular-devkit/build-angular:browser"
- add
customWebpackConfig
key inoptions
object with a path to a file that you will create later:"options": { "customWebpackConfig": {"path": "custom-webpack-config.js"} }