reactjs - 有没有办法覆盖 create-react-app webpack 配置中的 ESLintPlugin 选项?
问题描述
所以我在我的反应应用程序中遇到了 eslint 的问题,我能够在弹出应用程序并ESLintPlugin
在webpack.config
文件中添加一些选项后解决它。
new ESLintPlugin({
// Plugin options
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
context: paths.appSrc,
failOnError: false, <== this one
emitWarning: true, <== and this one
// ESLint class options
cwd: paths.appPath,
resolvePluginsRelativeTo: __dirname,
baseConfig: {
extends: [require.resolve('eslint-config-react-app/base')],
rules: {
...(!hasJsxRuntime && {
'react/react-in-jsx-scope': 'error'
})
}
}
})
我想知道我是否可以做同样的事情,但不必弹出应用程序,react-app-rewired
而是使用,我已经有一个config-overrides.js
文件
module.exports = function override(webpackConfig) {
webpackConfig.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
});
return webpackConfig;
};
是否有类似的方法可以访问文件中的 ESLintPlugin 函数webpack.config
并通过文件向其添加新选项config-overrides.js
?
解决方案
推荐阅读
- bash - 如何查找字符串中是否缺少一系列非浮点数
- java - 使用值对象中的字段对地图列表进行排序
- qt - QML chartview 获取 Lineseries.onPointAdded 的 X,Y
- tensorflow - 将delf转换为tensorflow js web时出错
- vba - 在工作表 1 的 A 列中搜索一个值,将其复制到工作表 2,然后复制接下来的三行
- anaconda - 从 Anaconda 或 julialang.org 下载 Julia
- python - 如何在格式化的 python 字符串中转义单个反斜杠?
- c++ - 插入 boost::multi_index 后,迭代器变得无效?
- c# - 如何解决“AlprNet”找不到?
- continuous-integration - 有没有办法使用 Salesforce DX 与 TeamCity 进行持续集成