1
虽然项目运行成功, 但是会有很多TS报错打印出来, 浏览器页面也会弹出报错信息覆盖页面
expectation: 关闭控制台的TS类型报错, 但不要关闭项目里的类型校验
虽然项目运行成功, 但是会有很多TS报错打印出来, 浏览器页面也会弹出报错信息覆盖页面
expectation: 关闭控制台的TS类型报错, 但不要关闭项目里的类型校验
找到办法了 增加如下配置
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const ForkTsCheckerWarningWebpackPlugin = require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin');
configure: (webpackConfig, { env, paths }) => {
// 过滤ts类型校验插件
webpackConfig.plugins = webpackConfig.plugins.filter((item) => {
if (
item instanceof ForkTsCheckerWebpackPlugin ||
item instanceof ForkTsCheckerWarningWebpackPlugin
) {
return false;
}
return true;
});
return webpackConfig;
}