Issue
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;
};
This is the eslintrc file:
{
"extends": "@react-native-community",
"rules": {
"prettier/prettier": ["error", { "printWidth": 120 }],
"react/react-in-jsx-scope": "off",
"quotes": [2, "double", { "avoidEscape": true }]
}
}
But I still get this error:
Parsing error: No Babel config file detected for C:\repos\Dierenwelzijn\DWL_frontend\webpack.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?
Solution
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
...
}
Answered By - Damodar Hegde
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.