Chevrotain / chevrotain

Parser Building Toolkit for JavaScript
https://chevrotain.io
Apache License 2.0
2.48k stars 204 forks source link

NPM package missing sourcemap #1775

Closed ChrisCrossCrash closed 2 years ago

ChrisCrossCrash commented 2 years ago

I have a Create React App project which has Chevrotain as a sub-dependency of it. When I start the dev server with yarn start, the site works, but I get this warning:

Compiled with warnings.

Failed to parse source map from '/home/ck/projects/depth-section-example/node_modules/@chevrotain/utils/lib/src/api.js.map' file: Error: ENOENT: no such file or directory, open '/home/ck/projects/depth-section-example/node_modules/@chevrotain/utils/lib/src/api.js.map'

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

asset static/js/bundle.js 3.58 MiB [emitted] (name: main) 1 related asset
asset index.html 1.33 KiB [emitted]
asset asset-manifest.json 190 bytes [emitted]
orphan modules 5.13 MiB [orphan] 538 modules
runtime modules 28.3 KiB 14 modules
cacheable modules 3.42 MiB
  modules by path ./node_modules/ 3.4 MiB 113 modules
  modules by path ./src/ 12.6 KiB
    modules by path ./src/*.css 7.5 KiB
      ./src/index.css 2.72 KiB [built] [code generated]
      ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/index.css 1.37 KiB [built] [code generated]
      ./src/App.css 2.72 KiB [built] [code generated]
      ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/App.css 702 bytes [built] [code generated]
    modules by path ./src/*.tsx 5.12 KiB
      ./src/index.tsx 1.52 KiB [built] [code generated]
      ./src/App.tsx 3.6 KiB [built] [code generated]

WARNING in ./node_modules/@chevrotain/utils/lib/src/api.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/ck/projects/depth-section-example/node_modules/@chevrotain/utils/lib/src/api.js.map' file: Error: ENOENT: no such file or directory, open '/home/ck/projects/depth-section-example/node_modules/@chevrotain/utils/lib/src/api.js.map'
 @ ./node_modules/chevrotain/lib/src/parse/errors_public.js 10:12-40 12:14-42
 @ ./node_modules/chevrotain/lib/src/api.js 99:22-54
 @ ./node_modules/chevrotain/lib_esm/api_esm.mjs 1:0-36 2:15-18 3:27-42 4:27-42 5:25-38 6:25-38 7:19-26 8:34-56 9:37-62 10:27-42 11:21-30 12:40-68 13:40-68 14:36-60 15:27-42 16:42-72 17:22-32 18:22-32 19:41-70 20:26-40 21:35-58 22:48-84 23:39-66 24:20-28 25:24-36 26:23-34 27:26-40 28:40-68 29:27-42 30:35-58 31:41-70 32:42-72 33:38-64 34:32-52 35:35-58 36:26-40 37:28-44 38:25-38
 @ ./node_modules/three-stdlib/loaders/VRMLLoader.js 2:0-59 58:30-41 62:25-36 80:22-33 85:23-34 90:18-29 95:18-29 100:20-31 105:17-28 111:28-39 115:25-36 119:28-39 123:26-37 127:27-38 131:26-37 135:22-33 139:22-33 143:21-32 147:21-32 151:22-33 154:15-28 158:25-36 161:15-28 2382:21-26 2398:25-34
 @ ./node_modules/three-stdlib/index.js 273:0-53 273:0-53
 @ ./node_modules/@react-three/drei/web/Select.js 4:0-44 49:23-35
 @ ./node_modules/@react-three/drei/index.js 7:0-52 7:0-52 7:0-52
 @ ./src/App.tsx 9:0-40 28:36-39
 @ ./src/index.tsx 7:0-24 10:33-36

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.69.1 compiled with 1 warning in 17623 ms
No issues found.

Here's a commit of my project that replicates the issue.

It looks like the problem caused by @chevrotain/utils/lib/src/api.js pointing to a sourcemap that doesn't exist. To visualize the problem:

image

I also created the package depth-section, which this project depends on. I guess when I import a component from depth-section, it tries to load sourcemaps for all of that component's dependencies. Since Chevrotain is a dependency and it's pointing to a non-existent sourcemap, it causes this warning when I run my CRA project.

bd82 commented 2 years ago

Hello @ChrisCrossCrash this looks like a duplicate of https://github.com/Chevrotain/chevrotain/issues/1773 See the info and links on that issue.

bd82 commented 2 years ago

closing as duplicate

ChrisCrossCrash commented 2 years ago

Thanks for your help :)