[英]Module not found when importing JSX file off github using create-react-app
I'm struggling with a "module not found" error off a relative import.我正在努力解决相对导入的“找不到模块”错误。 I'm trying to implement this github project: https://github.com/cvdlab/react-planner
我正在尝试实现这个 github 项目: https://github.com/cvdlab/react-planner
I've created a new create-react-app project and npm installed the project (react-planner).我创建了一个新的 create-react-app 项目,并且 npm 安装了该项目(react-planner)。 The readme file calls for downloading the "demo catalog" which contains the following file structure:
自述文件要求下载包含以下文件结构的“演示目录”:
> catalog > areas > holes > items > lines > utils > mycatalog.js
mycatalog.js contains the following: mycatalog.js 包含以下内容:
import * as Areas from "./areas/**/planner-element.jsx"; import * as Lines from "./lines/**/planner-element.jsx"; import * as Holes from "./holes/**/planner-element.jsx"; import * as Items from "./items/**/planner-element.jsx";
Upon running (npm start), I get module not found error on each of these imports.运行(npm start)时,我在每个导入中都收到模块未找到错误。
./src/catalog/mycatalog.js Module not found: Can't resolve './areas/**/planner-element.jsx' in 'C:\Users\sgola\Desktop\apps\planner\src\catalog'
These files are definitely located in their respective folders.这些文件肯定位于它们各自的文件夹中。 Catalog folder along with js files are all located in src folder.
目录文件夹以及 js 文件都位于 src 文件夹中。 Public contains only index.html and is located outside of src.
public 仅包含 index.html 并且位于 src 之外。 I've researched different possible issues from webpack/babel not compiling.jsx files to ** not being recognized as proper path syntax.
我研究了从 webpack/babel 不编译.jsx 文件到 ** 不被识别为正确路径语法的不同可能问题。 Nothing is working.
没有任何工作。 I'm at a loss, any help would be greatly appreciated.
我很茫然,任何帮助将不胜感激。
You have to add import globals plugin to Your project.您必须将导入全局插件添加到您的项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.