Closed spencerlepine closed 2 years ago
npm i dotenv
Update package.json
"scripts": {
"start": "npm run dev:client",
- "build": "dotenv -- webpack --config ./webpack.prod.config.js --mode production",
+ "build": "dotenv -e ../.env -- webpack --config ./webpack.prod.config.js --mode production",
"dev:client": "webpack serve --config ./webpack.dev.config.js --env development --mode development",
"test": "jest --detectOpenHandles --runInBand --forceExit",
"test:watch": "jest --onlyChanged --watch"
},
Problem
Webpack needs a physical
.env
file to referenec when runningnpm run build
. OR Webpack can reference the .env values from memory. HOWEVER, docker needs to pass these env variables down as it builds.Research
https://stackoverflow.com/questions/41359504/webpack-bundle-js-uncaught-referenceerror-process-is-not-defined