小编Gim*_*ana的帖子

如何修复错误“无法编译:./node_modules/@react-leaflet/core/esm/path.js 10:41 模块解析失败:意外令牌(10:41)”

我正在尝试创建一个react-typescript应用程序以及传单。我使用了命令,

npm install leaflet react-leaflet @types/react @types/leaflet --save 安装依赖项。

但是当我启动应用程序时,它说,

    ./node_modules/@react-leaflet/core/esm/path.js 10:41
Module parse failed: Unexpected token (10:41)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   useEffect(function updatePathOptions() {
|     if (props.pathOptions !== optionsRef.current) {
>       const options = props.pathOptions ?? {};
|       element.instance.setStyle(options);
|       optionsRef.current = options;
Run Code Online (Sandbox Code Playgroud)

这是我的 package.json

{
  "name": "aq-monitor",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.12.0",
    "@testing-library/react": …
Run Code Online (Sandbox Code Playgroud)

javascript leaflet typescript reactjs react-leaflet

55
推荐指数
5
解决办法
2万
查看次数

标签 统计

javascript ×1

leaflet ×1

react-leaflet ×1

reactjs ×1

typescript ×1