Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Source Map Files for parse5 in hast-util-raw Dependencies #624

Closed
nmahser opened this issue Mar 18, 2024 · 4 comments
Closed

Missing Source Map Files for parse5 in hast-util-raw Dependencies #624

nmahser opened this issue Mar 18, 2024 · 4 comments

Comments

@nmahser
Copy link

nmahser commented Mar 18, 2024

Description

When building a React project using react-md-editor, webpack emits warnings about missing source map files for the parse5 package, a dependency of hast-util-raw. This occurs despite a successful installation.

Steps to Reproduce

  1. Create a new React project with create-react-app and include react-md-editor as a dependency.
  2. Run the build process -npm run build
  3. Observe the warnings in the console regarding missing source map files for parse5 within the hast-util-raw package.

Environment

  • Node.js version: v18.14.0
  • NPM version: 9.5.0
  • react-md version: 4.0.4

Error and Warning messages in the console:

WARNING in ./node_modules/hast-util-from-html/node_modules/parse5/dist/tokenizer/preprocessor.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-from-html/node_modules/parse5/dist/tokenizer/preprocessor.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-from-html/node_modules/parse5/dist/tokenizer/preprocessor.js.map'

WARNING in ./node_modules/hast-util-from-html/node_modules/parse5/dist/tree-adapters/default.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-from-html/node_modules/parse5/dist/tree-adapters/default.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-from-html/node_modules/parse5/dist/tree-adapters/default.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/common/doctype.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/doctype.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/doctype.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/common/error-codes.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/error-codes.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/error-codes.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/common/foreign-content.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/foreign-content.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/foreign-content.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/common/html.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/html.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/html.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/common/token.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/token.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/token.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/common/unicode.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/unicode.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/common/unicode.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/index.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/index.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/parser/formatting-element-list.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/parser/formatting-element-list.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/parser/formatting-element-list.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/parser/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/galileo-frontend/node_modules/hast-util-raw/node_modules/parse5/dist/parser/index.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/parser/index.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/parser/open-element-stack.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/parser/open-element-stack.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/parser/open-element-stack.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/serializer/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/serializer/index.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/serializer/index.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/index.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/index.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/preprocessor.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/preprocessor.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/preprocessor.js.map'

WARNING in ./node_modules/hast-util-raw/node_modules/parse5/dist/tree-adapters/default.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/tree-adapters/default.js.map' file: Error: ENOENT: no such file or directory, open '/home/user/project/md-test/node_modules/hast-util-raw/node_modules/parse5/dist/tree-adapters/default.js.map'

package.json:

{
  "name": "md-test",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/lodash": "^4.14.194",
    "@types/node": "^16.18.12",
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "@uiw/react-md-editor": "^4.0.4",
    "ag-grid-community": "^30.2.0",
    "ag-grid-react": "^30.2.0",
    "antd": "^5.8.6",
    "downshift": "^7.6.0",
    "highlight.js": "^11.9.0",
    "json-loader": "^0.5.7",
    "match-sorter": "^6.3.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-icons": "^4.10.1",
    "react-markdown": "^8.0.7",
    "react-query": "^3.39.3",
    "react-router-dom": "^6.8.1",
    "react-scripts": "5.0.1",
    "remark-gfm": "^3.0.1",
    "typescript": "^4.9.5",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "export REACT_APP_ENVIRONMENT=local-dev && export FAST_REFRESH=false && react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "prettier": "prettier --list-different '**/*{.js,.tsx,.ts,json,scss,css}'"
  },
  "jest": {
    "transformIgnorePatterns": [
      "node_modules/(?!@remark-gfm)/"
    ],
    "moduleNameMapper": {
      "react-markdown": "<rootDir>/node_modules/react-markdown/react-markdown.min.js"
    }
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "prettier": "^2.8.4"
  }
}

Part of package-lock.json:

"node_modules/@uiw/react-md-editor": {
      "version": "4.0.4",
      "resolved": "https://registry.npmjs.org/@uiw/react-md-editor/-/react-md-editor-4.0.4.tgz",
      "integrity": "sha512-JH9nDXXRhJtWPP4yE61VE+9ryFo9tg9v7KMwGfJCnaOOKuLF1MR3l/MNsiJCGkRjUwyto5WrU7kBSq8ODJEtYw==",
      "dependencies": {
        "@babel/runtime": "^7.14.6",
        "@uiw/react-markdown-preview": "^5.0.6",
        "rehype": "~13.0.0",
        "rehype-prism-plus": "~2.0.0"
      },
      "funding": {
        "url": "https://jaywcjlove.github.io/#/sponsor"
      },
      "peerDependencies": {
        "react": ">=16.8.0",
        "react-dom": ">=16.8.0"
      }
    },
    ```
@jaywcjlove
Copy link
Member

@nmahser If you are webpack, you can add this configuration.

conf.ignoreWarnings = [
{
module: /node_modules[\\/]parse5[\\/]/,
},
];

@jaywcjlove
Copy link
Member

jaywcjlove commented Mar 19, 2024

@nmahser

You can remove the warning by adding GENERATE_SOURCEMAP=false to your .env file

Actually, CRA with Webpack 5.x cause it. They are working on resolving (facebook/create-react-app#11752)

@jaywcjlove
Copy link
Member

 "scripts": {
    "start": "GENERATE_SOURCEMAP=false && react-scripts start",

@nmahser
Copy link
Author

nmahser commented Mar 19, 2024

Thanks!

@nmahser nmahser closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants