skip to Main Content

I have a react native web app. And I try to run the app with the webpack.config.js file.

So I installed webpack and webpack-cli. And Added in package.json this:

{
    "name": "app",
    "version": "1.0.0",
    "main": "node_modules/expo/AppEntry.js",
    "scripts": {
        "start": "expo start, react-app-rewired start ",
        "android": "expo start --android",
        "ios": "expo start --ios",
        "web": "expo start --web",
        "eject": "expo eject",
        "lint": "eslint . --ext .js",
        "postinstall": "patch-package",
        "build": "webpack --config webpack.config.js",
        "start-webpack": "webpack-dev-server --mode production --open"
    },

    "parserOptions": {
        "parser": "@babel/eslint-parser",
        "requireConfigFile": false
    },

and the webpack.config.js file looks:

const createExpoWebpackConfigAsync = require("@expo/webpack-config");


module.exports = async function (env, argv) {
    const config = await createExpoWebpackConfigAsync(env, argv);


    
    if (config.mode === "production") {
        config.devServer.compress = false;
    }

    return config;
};

But I still get this error:

Parsing error: No Babel config file detected for C:reposDierenwelzijnDWL_frontendwebpack.config.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.eslint

But the file is located at this url.

Question: how to resolve this issue?

2

Answers


  1. In your .eslintrc.js, add:

    "eslint.workingDirectories": [
            {"mode": "auto"}
        ],
    

    If not there, add too:

    parserOptions: {
      parser: '@babel/eslint-parser',
      requireConfigFile: false,
      ...
    }
    
    Login or Signup to reply.
  2. I faced the same issue earlier. You need to add requireConfigFile: false to you .eslintrc.js file.

    parserOptions: {
      parser: '@babel/eslint-parser',
      requireConfigFile: false, // ADD THIS
      ...
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search