Search code examples
reactjswebpackelectronenvironment-variablesbabeljs

Errors after running eject on react application


I am building an electron app that utilizes react for the UI. I need to override the webpack.config.js file, and so I have ran the eject script, however I am now receiving the following error. There are limited resources regarding this issue so I am unsure what I can do to solve this.

Using babel-preset-react-app requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are "development", "test", and "production". Instead, received: undefined.

This error is appearing in every file, and is preventing it from compiling.


Solution

  • I managed to solve this issue by adding the following lines to my eslintConfig within my package.json file.

    "parser": "jsx",
    "parserOptions": { "babelOptions": { "presets": [ ["babel-preset-react-app", false] ] } }
    

    https://stackoverflow.com/a/72250757/7259551