javascript - Error importing component from forked npm package
问题描述
So, I'm making a small chat tool using react-chat-elements as UI library for chat components. I'd like to modify certain CSS values to match what I want to build without being tied to that specific library the way it is now (it hasn't been updated since 5 months ago).
So what I tried is fork it to my Github account, created the NPM package from it (react-chat-elements-av) without making any changes first to make sure it worked the same way as with the original. However, when I import a specific component from the NPM package I created, say import { MessageBox, SystemMessage } from "react-chat-elements-av";
, I get an error saying Attempted import error: 'MessageBox' is not exported from 'react-chat-elements-av'.
, being the attempted import location: /node_modules/react-chat-elements-av/index.
Now, if I import those two components from the original NPM package, import { MessageBox, SystemMessage } from "react-chat-elements";
, everything works and the import location is a bit different: /node_modules/react-chat-elements/dist/main.
Is there something I'm missing on the creation of that dist directory when doing npm install react-chat-elements-av
? I literally forked the original repo, and created the NPM package with it, no changes made to any webpack config or so.
Any idea what could be happening here?
Thanks in advance!
解决方案
该dist
存储库用于构建后的生产级代码。这是分发文件。下载后,尝试通过运行来查看他们是如何构建库的npm run build
。
推荐阅读
- backup - 如何备份存储在 Nexus 中的工件?
- typescript - 使用 typescript 泛型键入函数时出现问题
- dart - debounce() 和 switchMap() 的替代 Dart 函数是什么?
- javascript - if else 中的 promise 和同步代码的组合
- selenium - 在 testng.xml 文件中包含超过组的条件
- python - 返回以分组类别为键的字典并将满足条件的聚合数据作为pandas中的值
- html - 为什么滚动条是彩色的?
- react-native - React Native - 像 Material Bottom Navigator 一样向 Material Top Navigator 显示标签栏徽章
- c++ - C++:从派生类调用受保护的基类构造函数
- python - 根据python字典中的值添加新标签列