0
点赞
收藏
分享

微信扫一扫

Module parse failed: Unexpected token(双问号无法识别)

玩物励志老乐 2022-01-05 阅读 167

问题:

error  in ./node_modules/@react-leaflet/core/esm/path.js

Module parse failed: Unexpected token (10:41)
You may need an appropriate loader to handle this file type, currently no loaders areo process this file. See https://webpack.js.org/concepts#loaders
|   useEffect(function updatePathOptions() {
|     if (props.pathOptions !== optionsRef.current) {
>       const options = props.pathOptions ?? {};
|       element.instance.setStyle(options);
|       optionsRef.current = options;

 @ ./node_modules/@react-leaflet/core/esm/index.js 15:0-56 15:0-56 15:0-56
 @ ./node_modules/react-leaflet/esm/ZoomControl.js
 @ ./node_modules/react-leaflet/esm/index.js
 @ ./src/pages/RoadNetwork/RegionAnalysis/Travel/index.tsx
 @ ./src/.umi/core/routes.ts
 @ ./src/.umi/umi.ts
 @ multi ./node_modules/umi/node_modules/@umijs/preset-built-in/bundled/@pmmmwh/reactack-plugin/client/ReactRefreshEntry.js ./src/.umi/umi.ts

解决:
可能当前版本和环境 " ?? " 不能识别,所以把用函数将??替换掉即可。

function change(a, b) {
    return a !== undefined && a !== null ? a : b
  }
举报

相关推荐

0 条评论