1

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

但是,当我尝试运行我的应用程序时,我收到许多具有相同模式的错误:

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)
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)
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)
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 包含这些依赖项:

"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"
    },

我看到有人推荐包括"allowSyntheticDefaultImports": trueon tsconfig.json,但是,我没有这个文件,因为我没有使用 Typescript。所以我添加了 Typescript 和那一行,但所有错误仍然存​​在。


由于这是 node_module 文件夹中的错误,我不相信编辑包会起作用


我还尝试创建其他反应项目来测试这个,之后没有任何变化

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

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


非常感谢您的宝贵时间

4

1 回答 1

0

For anyone that has the same problem with atlaskit, I asked here too, and looks like this is a dependency problem.

To solve it for me, I downgraded some packages to match this configuration:

"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"
  }

As Ryker Tyler said on the other forum:

According to my experience with Atlaskit, it has a huge dependence on the version of react, react-scripts, webpack and also its own peer dependencies (between @atlaskit/editor-core and @atlaskit/media-core for example, and it also requires peer dependencies on react-intl and styled-components on the specific version.

Some Atlaskit components are not yet compatible with React 17 and react-scripts 5.x.x. They are still dependent on React 16 and react-scripts 4.x.x.

I think you could try to downgrade to React 16 and react-scripts 4 if you want to work well with Atlaskit.

于 2022-01-14T17:19:25.717 回答