rtfpessoa / diff2html

Pretty diff to html javascript library (diff2html)
https://diff2html.xyz
MIT License
2.8k stars 273 forks source link

Failed to parse source map #436

Closed sewolf closed 11 months ago

sewolf commented 2 years ago

Step 0: Describe your environment

Step 1: Describe the problem:

the webpack dev server returns compile warnings

Observed Results:

Compiled with 11 warnings.

Failed to parse source map from '/Users/sewolf/workspace/myproject/node_modules/diff2html/src/diff-parser.ts' file: Error: ENOENT: no such file or directory, open '/Users/sewolf/workspace/myproject/node_modules/diff2html/src/diff-parser.ts'

rtfpessoa commented 2 years ago

It is very hard to understand what is happening, in what context did this happen? What versions of node etc were you running?

sewolf commented 2 years ago

i hava a typescript project created with create-react-app and installed diff2html v. 3.4.17 (node v18.3.0). When i start the development server with "npm run start" the i see this warnings.

rtfpessoa commented 2 years ago

👋 Version 3.4.17 does not exist, can you double check that? Also, can you provide maybe a snippet or a script to replicate the error?

sewolf commented 2 years ago

here is also the 3.4.17 version https://www.npmjs.com/package/diff2html/v/3.4.17

test project: https://github.com/sewolf/diff2html-app

console output after npm run start:

WARNING in ./node_modules/diff2html/lib-esm/diff-parser.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/diff-parser.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/diff-parser.ts'

WARNING in ./node_modules/diff2html/lib-esm/diff2html-templates.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/diff2html-templates.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/diff2html-templates.ts'

WARNING in ./node_modules/diff2html/lib-esm/diff2html.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/diff2html.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/diff2html.ts'

WARNING in ./node_modules/diff2html/lib-esm/file-list-renderer.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/file-list-renderer.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/file-list-renderer.ts'

WARNING in ./node_modules/diff2html/lib-esm/hoganjs-utils.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/hoganjs-utils.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/hoganjs-utils.ts'

WARNING in ./node_modules/diff2html/lib-esm/line-by-line-renderer.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/line-by-line-renderer.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/line-by-line-renderer.ts'

WARNING in ./node_modules/diff2html/lib-esm/rematch.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/rematch.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/rematch.ts'

WARNING in ./node_modules/diff2html/lib-esm/render-utils.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/render-utils.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/render-utils.ts'

WARNING in ./node_modules/diff2html/lib-esm/side-by-side-renderer.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/side-by-side-renderer.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/side-by-side-renderer.ts'

WARNING in ./node_modules/diff2html/lib-esm/types.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/types.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/types.ts'

WARNING in ./node_modules/diff2html/lib-esm/utils.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/private/tmp/diff2html-app-main/node_modules/diff2html/src/utils.ts' file: Error: ENOENT: no such file or directory, open '/private/tmp/diff2html-app-main/node_modules/diff2html/src/utils.ts'

rtfpessoa commented 2 years ago

So seems like it does not fail. It just throws warnings. I have no idea why it is looking for source maps or even how to generate them.

I am just using regular webpack to build the project. If you know how to fix this let me know. But honestly not sure why it would show warnings if they do not exist.

sewolf commented 2 years ago

here is the same problem described: https://stackoverflow.com/questions/70599784/failed-to-parse-source-map i have also added GENERATE_SOURCEMAP=false in .env file to remove this warnings

rtfpessoa commented 11 months ago

Closing for inactivity.