Source maps linking to non-existing source files
Opened this issue · 0 comments
MBuchalik commented
When using @sniptt/monads
in React, I am getting a warning indicating that source maps are pointing to non-existing files.
Expected behavior
I expected the library to compile without any compiler warnings.
Actual behavior
When compiling, the React compiler (to be more precise: source-maps-loader
) prints multiple warnings, all looking similar to the following:
WARNING in ./node_modules/@sniptt/monads/build/result/result.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '[Path to my project]\node_modules\@sniptt\monads\lib\result\result.ts' file: Error: ENOENT: no such file or directory, open '[Path to my project]\node_modules\@sniptt\monads\lib\result\result.ts'
Potential reason
It seems like the source maps are pointing to a "lib" folder that does not exist. For instance, build/result/result.js.map
has the following content:
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../lib/result/result.ts"], [...]
Thus, this source map is trying to reference (root)/lib/result/result.ts
. However, the lib/
folder does not exist since it is not part of the package; only the build/
folder is currently included in package.json
:
Environment
@sniptt/monads
: Version0.5.10
- Project based on Create-React-App with React
18.2.0
.