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

Source maps linking to non-existing source files #110

Open
MBuchalik opened this issue Oct 17, 2022 · 0 comments
Open

Source maps linking to non-existing source files #110

MBuchalik opened this issue Oct 17, 2022 · 0 comments

Comments

@MBuchalik
Copy link

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:

https://github.com/sniptt-official/monads/blob/fe0b45709cf3efa0a82b2602c3ef619553fbe21e/package.json#L11-L13

Environment

  • @sniptt/monads: Version 0.5.10
  • Project based on Create-React-App with React 18.2.0.
@MBuchalik MBuchalik changed the title Sourcemaps linking to non-existing source files Source maps linking to non-existing source files Oct 17, 2022
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

1 participant