首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:不应该导入命名的导出.@atlaskit/编者-core

错误:不应该导入命名的导出.@atlaskit/编者-core
EN

Stack Overflow用户
提问于 2022-01-12 22:05:28
回答 1查看 577关注 0票数 3

我第一次尝试使用@atlaskit/editor-core。我用npm i @atlaskit/editor-core安装了它,我的npm版本是8.3.0,我的节点版本是16.13.1

然而,当我试图运行我的应用程序时,我会得到许多相同模式的错误:

代码语言:javascript
复制
ERROR in ./node_modules/@atlaskit/editor-core/dist/esm/plugins/feedback-dialog/index.js 95:183-1
Should not import the named export 'version' (imported as 'coreVersion') from default-exporting lt export is available soon)
代码语言:javascript
复制
ERROR in ./node_modules/@atlaskit/status/dist/esm/components/analytics.js 53:43-54
Should not import the named export 'name' (imported as 'packageName') from default-exporting module (only default 
export is available soon)
代码语言:javascript
复制
ERROR in ./node_modules/@atlaskit/analytics-listeners/dist/esm/atlaskit/process-event.js 97:21-3
Should not import the named export 'version' (imported as 'listenerVersion') from default-exportefault export is available soon)
代码语言:javascript
复制
ERROR in ./node_modules/@atlaskit/editor-common/dist/esm/ui/LegacyToNextIntlProvider/index.js 11
export 'intlShape' (imported as 'intlShape') was not found in 'react-intl'

还有其他类似的。

我的package.json包含以下依赖项:

代码语言:javascript
复制
"dependencies": {
        "@atlaskit/editor-core": "^153.1.3",
        "@atlaskit/media-core": "^32.2.0",
        "@emotion/react": "^11.7.1",
        "@emotion/styled": "^11.6.0",
        "@mui/icons-material": "^5.2.5",
        "@mui/material": "^5.2.7",
        "@testing-library/jest-dom": "^5.16.1",
        "@testing-library/react": "^11.2.7",
        "@testing-library/user-event": "^12.8.3",
        "emoji-picker-react": "^3.5.0",
        "firebase": "^9.6.1",
        "react": "^17.0.2",
        "react-dom": "^17.0.2",
        "react-google-button": "^0.7.2",
        "react-intl": "^5.24.2",
        "react-mde": "^11.5.0",
        "react-redux": "^7.2.6",
        "react-router-dom": "^6.2.1",
        "react-scripts": "5.0.0",
        "redux": "^4.1.2",
        "redux-thunk": "^2.4.1",
        "sass": "^1.47.0",
        "showdown": "^1.9.1",
        "simplemde": "^1.11.2",
        "styled-components": "^3.2",
        "web-vitals": "^0.2.4",
        "workbox-background-sync": "^5.1.4",
        "workbox-broadcast-update": "^5.1.4",
        "workbox-cacheable-response": "^5.1.4",
        "workbox-core": "^5.1.4",
        "workbox-expiration": "^5.1.4",
        "workbox-google-analytics": "^5.1.4",
        "workbox-navigation-preload": "^5.1.4",
        "workbox-precaching": "^5.1.4",
        "workbox-range-requests": "^5.1.4",
        "workbox-routing": "^5.1.4",
        "workbox-strategies": "^5.1.4",
        "workbox-streams": "^5.1.4"
    },

我看到了一些人建议在tsconfig.json上包括tsconfig.json,但是我没有这个文件,因为我没有使用类型记录。所以我添加了类型记录和那一行,但是所有的错误都会持续存在。

由于这是node_module文件夹中的一个错误,我不认为编辑包会工作

我还尝试创建其他的react项目来测试这一点,之后没有任何更改。

代码语言:javascript
复制
npx create-react-app my-app
cd my-app
yarn add @atlaskit/editor-core

// Add on index.js 
// - import { Editor } from "@atlaskit/editor-core";
// - <Editor appearance="comment" />;

yarn start

但不幸的是,这也给了我同样的错误。

非常感谢你抽出时间

EN

回答 1

Stack Overflow用户

发布于 2022-01-14 17:19:25

对于与atlaskit有同样问题的人,我也问了这里,看起来这是一个依赖问题。

为了解决这个问题,我降低了一些软件包的级别,以匹配这个配置:

代码语言:javascript
复制
"dependencies": {
    "@atlaskit/editor-core": "^151.3.0",
    "@atlaskit/media-core": "^32.2.0",
    "@atlaskit/renderer": "^81.1.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-intl": "2.8.0",
    "react-scripts": "4.0.3",
    "styled-components": "^3.2.6"
  }

正如赖克·泰勒在另一个论坛上所说:

根据我在Atlaskit的经验,它在很大程度上依赖于react、react脚本、webpack以及它自己的对等依赖(例如@atlaskit/editor-core和@atlaskit/media-core ),而且它还需要在特定版本上的react组件(intl和样式)上的对等依赖。有些Atlaskit组件还不兼容React 17和react脚本5.x.x。它们仍然依赖于React 16和react脚本4.x.x。我认为你可以尝试降级,以反应16和反应-脚本4,如果你想要很好地与亚特兰斯基特。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70688996

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档