首页 > 解决方案 > 您可能需要一个额外的加载器来处理这些加载器的结果。是由 OR 分配引起的

问题描述

在我的 Typescript React 代码中:

return changed ||= false

使用运算符时,我不断收到此错误||=(我认为来自 webpack)

Module parse failed: Unexpected token (85:8)
File was processed with these loaders:
 * ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     checkParams.forEach(param => {
>       return changed ||= false;
|     });

当我删除||=操作员时,错误消失了

return changed = changed | false

为什么会这样?

标签: reactjstypescriptwebpackcreate-react-app

解决方案


推荐阅读