fb55/htmlparser2

Problem with source maps

rgischk opened this issue · 2 comments

I just migrated to version 8.0.1, and now I get the following warnings while building:

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\feeds.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/feeds.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\helpers.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/helpers.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\index.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/index.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\legacy.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/legacy.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\manipulation.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/manipulation.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\querying.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/querying.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\stringify.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/stringify.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\domutils-npm-3.0.1-7937818218-23aa7a8405.zip\node_modules\domutils\lib\esm\https:\raw.githubusercontent.com\fb55\domutils\f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706\src\traversal.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/domutils/lib/esm/https:/raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/traversal.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\decode.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/decode.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\decode_codepoint.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/decode_codepoint.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\encode.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/encode.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\escape.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/escape.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\generated\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\generated\decode-data-html.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/generated/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/generated/decode-data-html.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\generated\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\generated\decode-data-xml.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/generated/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/generated/decode-data-xml.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\generated\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\generated\encode-html.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/generated/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/generated/encode-html.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\entities-npm-4.4.0-97635dc5cc-84d250329f.zip\node_modules\entities\lib\esm\https:\raw.githubusercontent.com\fb55\entities\867ac709ba482a56a98b7c35f49ca833c74dc193\src\index.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/entities/lib/esm/https:/raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/index.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\htmlparser2-npm-8.0.0-8c97d27d9e-2e89e92d86.zip\node_modules\htmlparser2\lib\esm\https:\raw.githubusercontent.com\fb55\htmlparser2\8ccc67c159d10798a319a925bae7d21b70b0e65c\src\Parser.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/htmlparser2/lib/esm/https:/raw.githubusercontent.com/fb55/htmlparser2/8ccc67c159d10798a319a925bae7d21b70b0e65c/src/Parser.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\htmlparser2-npm-8.0.0-8c97d27d9e-2e89e92d86.zip\node_modules\htmlparser2\lib\esm\https:\raw.githubusercontent.com\fb55\htmlparser2\8ccc67c159d10798a319a925bae7d21b70b0e65c\src\Tokenizer.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/htmlparser2/lib/esm/https:/raw.githubusercontent.com/fb55/htmlparser2/8ccc67c159d10798a319a925bae7d21b70b0e65c/src/Tokenizer.ts'

Failed to parse source map from 'C:\my-app\.yarn\cache\htmlparser2-npm-8.0.0-8c97d27d9e-2e89e92d86.zip\node_modules\htmlparser2\lib\esm\https:\raw.githubusercontent.com\fb55\htmlparser2\8ccc67c159d10798a319a925bae7d21b70b0e65c\src\index.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/htmlparser2/lib/esm/https:/raw.githubusercontent.com/fb55/htmlparser2/8ccc67c159d10798a319a925bae7d21b70b0e65c/src/index.ts'

I am using the latest version of create-react-app and yarn 3 with plug and play enabled. You can reproduce this issue by following these steps:

yarn create react-app my-app
cd my-app
yarn set version berry
yarn install
# remove line "nodeLinker: node-modules" from the .yarnrc.yml file to enable Plug'n'Play
yarn install
# remove "eslintConfig" entry from package.json because the CRA template is broken by default
yarn add htmlparser2@8.0.0
# add an import statement to the App.js file: import * as htmlparser2 from "htmlparser2";
yarn build

As you can see from the warnings, this does not only affect the package htmlparser2, but also the packages entities and domutils. I previously used version 7.2.0, which did not throw these warnings.

I investigated this issue some more and I found out that it is not actually related to yarn 3 plug and play, as I intentionally expected. It does indeed also occur with yarn 1 (classic). I think the issue is actually located in the package source-map-loader, which does not support absolute URLs as the sourceRoot for source maps. I created an according issue: webpack-contrib/source-map-loader#186

fb55 commented

Awesome, thanks so much for figuring this out!