baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.06k stars 2.48k forks source link

amis-editor@5.2.1-beta.33的package.json的dependencies需要添加mobx跟mobx-react的依赖 #5938

Closed tipsxBase closed 1 year ago

tipsxBase commented 1 year ago

描述问题:

amis-editor@5.2.1-beta.33的代码中会使用mobxmobx-react但是amis-editor@5.2.1-beta.33的package.json的dependencies没有mobx跟mobx-react的依赖,如果通过npm的方式使用amis-editor的项目中本身也使用mobx,而且使用的mobx版本跟amis-editor使用的mobx版本不一致的话,amis-editor因为自己的node_modules下面没有mobx跟mobx-react,这样会导致amis-editor引用到项目本身的mobx,而不是它自己依赖的mobx@4.15.7这个版本,这样的话就会出现mobx版本冲突的问题。

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的? npm

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在 amis-editor@5.2.1-beta.33

  3. 目前amis-editor@5.2.1-beta.33的package.json是:

    
    {
    "name": "amis-editor",
    "version": "5.2.1-beta.33",
    "description": "amis 可视化编辑器",
    "main": "lib/index.js",
    "module": "esm/index.js",
    "types": "lib/index.d.ts",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "npm run clean-dist && NODE_ENV=production rollup -c ",
    "clean-dist": "rimraf lib/* esm/*",
    "i18n:update": "npx i18n update --config=./i18nConfig.js",
    "i18n:translate": "npx i18n translate --config=./i18nConfig.js --l=en-US",
    "i18n:merge": "npx i18n merge --config=./i18nConfig.js --l=en-US"
    },
    "keywords": [
    "amis",
    "editor"
    ],
    "author": "@fex",
    "license": "ISC",
    "files": [
    "lib",
    "esm"
    ],
    "dependencies": {
    "@webcomponents/webcomponentsjs": "^2.6.0",
    "amis-editor-core": "*",
    "i18n-runtime": "*",
    "lodash": "^4.17.15",
    "mobx-state-tree": "^3.17.3"
    },
    "devDependencies": {
    "@fortawesome/fontawesome-free": "^5.15.3",
    "@rollup/plugin-commonjs": "^22.0.0",
    "@rollup/plugin-json": "^4.1.0",
    "@rollup/plugin-node-resolve": "^13.3.0",
    "@rollup/plugin-typescript": "^8.3.2",
    "@svgr/rollup": "^6.2.1",
    "@types/async": "^2.0.45",
    "@types/classnames": "^2.2.3",
    "@types/codemirror": "^5.60.5",
    "@types/deep-diff": "^1.0.0",
    "@types/history": "^4.6.0",
    "@types/hoist-non-react-statics": "^3.0.1",
    "@types/lodash": "^4.14.76",
    "@types/node": "^14.0.24",
    "@types/qs": "^6.5.1",
    "@types/react": "^18.0.24",
    "@types/react-dom": "^18.0.8",
    "@types/react-router": "^4.0.16",
    "@types/react-router-dom": "^5.1.7",
    "@types/sortablejs": "^1.10.7",
    "@types/tinycolor2": "^1.4.3",
    "ajv": "^8.8.2",
    "amis": "2.5.2",
    "amis-core": "2.5.2",
    "amis-formula": "2.5.2",
    "amis-ui": "2.5.2",
    "axios": "0.21.1",
    "concurrently": "^6.2.0",
    "css-loader": "^6.2.0",
    "faker": "^5.5.3",
    "husky": "^7.0.0",
    "lint-staged": "^12.1.2",
    "mini-css-extract-plugin": "^2.3.0",
    "prettier": "^2.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-overlays": "5.1.1",
    "react-router": "5.2.0",
    "react-router-dom": "5.2.0",
    "rimraf": "^3.0.2",
    "rollup": "^2.73.0",
    "rollup-plugin-auto-external": "^2.0.0",
    "rollup-plugin-license": "^2.7.0",
    "sass": "^1.49.7",
    "sass-loader": "^12.5.0",
    "style-loader": "^3.2.1",
    "stylelint": "^14.11.0",
    "ts-jest": "^28.0.3",
    "ts-json-schema-generator": "0.96.0",
    "ts-loader": "^9.2.5",
    "ts-node": "^10.5.0",
    "tslib": "^2.3.1",
    "typescript": "^4.6.4"
    },
    "peerDependencies": {
    "amis": "*",
    "amis-core": "*",
    "amis-formula": "*",
    "amis-ui": "*",
    "i18n-runtime": "*",
    "react": ">=16.8.6",
    "react-dom": ">=16.8.6"
    }
    }
github-actions[bot] commented 1 year ago

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

wibetter commented 1 year ago

@tipsxBase amis-editor 的dependencies依赖中有amis-editor-core,而amis-editor-core的dependencies是有mobx这几个依赖的,所以安装amis-editor正常情况下会自动安装上mobx这几个模块的。

wibetter commented 1 year ago
image