我有一个react原生Web应用程序。我尝试使用webpack.js.js文件运行该应用程序。
所以我安装了webpack和webpack-json。并在package.json中添加了以下内容:
{
"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
},
字符串
webpack.js.js文件看起来:
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;
};
型
这是eslintrc文件:
{
"extends": "@react-native-community",
"rules": {
"prettier/prettier": ["error", { "printWidth": 120 }],
"react/react-in-jsx-scope": "off",
"quotes": [2, "double", { "avoidEscape": true }]
}
}
型
但我还是犯了这个错误:
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
型
但文件位于此URL。
问:如何解决这个问题?
2条答案
按热度按时间fdx2calv1#
我之前也遇到过同样的问题。你需要将
requireConfigFile: false
添加到你的.eslintrc.js
文件中。字符串
q9yhzks02#
在
.eslintrc.js
中,添加:字符串
如果没有,也添加:
型