mdx-editor / editor

A rich text editor React component for markdown
https://mdxeditor.dev
MIT License
1.57k stars 124 forks source link

[BUG] ERR_PACKAGE_PATH_NOT_EXPORTED eslint-plugin-import error when importing @mdx-editor/editor #466

Closed hsunami10 closed 1 month ago

hsunami10 commented 1 month ago

If you want to ask for support or request features, sponsor the project and contact me over email.

Describe the bug

When running ESLint, I get this error from eslint-plugin-import in the file that I import @mdx-editor/editor:

ESLint: 8.57.0

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib' is not defined by "exports" in /Users/name/frontend/node_modules/mdast-util-from-markdown/package.json
Occurred while linting /Users/name/frontend/src/ui/markdown/MarkdownEditor.tsx:1
Rule: "import/namespace"
    at exportsNotFound (node:internal/modules/esm/resolve:303:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:650:9)
    at resolveExports (node:internal/modules/cjs/loader:591:36)
    at Module._findPath (node:internal/modules/cjs/loader:668:31)
    at findModulePath (/Users/michaelhsu/vanna-portal/frontend/node_modules/eslint-import-resolver-alias/index.js:99:27)
    at exports.resolve (/Users/michaelhsu/vanna-portal/frontend/node_modules/eslint-import-resolver-alias/index.js:75:10)
    at withResolver (/Users/michaelhsu/vanna-portal/frontend/node_modules/eslint-module-utils/resolve.js:121:23)
    at fullResolve (/Users/michaelhsu/vanna-portal/frontend/node_modules/eslint-module-utils/resolve.js:142:22)
    at Function.relative (/Users/michaelhsu/vanna-portal/frontend/node_modules/eslint-module-utils/resolve.js:158:10)
    at remotePath (/Users/michaelhsu/vanna-portal/frontend/node_modules/eslint-plugin-import/lib/ExportMap.js:811:381)

I've ignored this error by adding the code snippet below in my .eslintrc.yml:

settings:
  import/ignore:
    - \.*@mdxeditor/editor.*$

I'd like an actual way to fix this though, if anyone has any ideas, please let me know!

package.json

{
  "name": "vanna-portal",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "lint": "eslint . --ext .ts,.tsx --report-unused-disable-directives --max-warnings 0",
    "lint:fix": "npm run --silent lint --fix",
    "prettier": "prettier --check \"src/**/*.{ts,tsx,css,md}\" --config ./.prettierrc.yml",
    "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,css,md}\" --config ./.prettierrc.yml",
    "format": "npm run --silent prettier:fix && npm run --silent lint:fix",
    "preview": "vite preview"
  },
  "dependencies": {
    "@emotion/react": "^11.11.4",
    "@mdxeditor/editor": "^3.3.5",
    "@types/mdast": "^4.0.4",
    "axios": "^1.7.2",
    "firebase": "^10.12.1",
    "markdown-to-jsx": "^7.4.7",
    "path": "^0.12.7",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "react-dropzone": "^14.2.3",
    "react-error-boundary": "^4.0.13",
    "react-router-dom": "^6.23.1",
    "react-toastify": "^10.0.5",
    "react-tooltip": "^5.26.4",
    "swr": "^2.2.5"
  },
  "devDependencies": {
    "@trivago/prettier-plugin-sort-imports": "^4.3.0",
    "@types/node": "^20.12.12",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.3.0",
    "@typescript-eslint/eslint-plugin": "^7.10.0",
    "@typescript-eslint/parser": "^7.10.0",
    "@vitejs/plugin-react-swc": "^3.6.0",
    "eslint": "^8.57.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-import-resolver-typescript": "^3.6.1",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-react": "^7.34.1",
    "eslint-plugin-react-hooks": "^4.6.2",
    "eslint-plugin-react-refresh": "^0.4.7",
    "prettier": "3.2.5",
    "typescript": "^5.4.5",
    "vite": "^5.2.11"
  }
}
github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 3.3.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

petyosi commented 1 month ago

Let me know if the above release fixes it for you.

hsunami10 commented 1 month ago

it's fixed, thanks a lot!!