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

Failed to parse source map warning #279

Closed
mirkonasato opened this issue Apr 26, 2022 · 3 comments · Fixed by #284
Closed

Failed to parse source map warning #279

mirkonasato opened this issue Apr 26, 2022 · 3 comments · Fixed by #284
Assignees

Comments

@mirkonasato
Copy link

After upgrading @apollo/client to 3.6.0 that depends on ts-invariant 0.10.1 I'm seeing the following warning from the React dev server at every code change:

Compiled with warnings.

Failed to parse source map from '/path/to/project/node_modules/ts-invariant/src/invariant.ts' file: Error: ENOENT: no such file or directory, open '/path/to/project/node_modules/ts-invariant/src/invariant.ts'

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

WARNING in ./node_modules/ts-invariant/lib/invariant.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):

This is in a project using react-scripts 5.0.1.

Before the upgrade I had @apollo/client 3.5.4 which used ts-invariant 0.9.4 (still the latest according to the npm registry) and there were no warnings.

@yanickrochon
Copy link

When the module is published there is no src folder. However, there is a ./lib/invariant.js.map file.

@timagixe
Copy link

Hi, I faced the same warning. I have created a simple repo to reproduce it. I used CRA 5.0.1 with typescript template:

yarn create react-app react-app-ts --template typescript

And installed following dependencies of Apollo Client and GraphQL:

"@apollo/client": "^3.6.1",
"graphql": "^16.4.0",

STR:

  1. clone https://github.com/timagixe/apollo-client-warning
  2. yarn install
  3. yarn start

@benjamn benjamn self-assigned this May 4, 2022
benjamn added a commit that referenced this issue May 4, 2022
Should resolve issue #279. Another possible resolution would be to ship
the src/ directory, but inlining source code into source maps tends to
be the most robust solution to these problems, in my experience.
benjamn added a commit that referenced this issue May 4, 2022
benjamn added a commit to apollographql/apollo-client that referenced this issue May 4, 2022
Includes apollographql/invariant-packages#284,
fixing apollographql/invariant-packages#279.

These warnings have been causing red herrings in (probably) unrelated
issues, most recently in #9662, so it makes sense to fix this problem
even if it's arguably harmless.
@benjamn
Copy link
Member

benjamn commented May 4, 2022

This should be fixed in [email protected] (just published to npm). Thanks to @yanickrochon @mirkonasato @timagixe for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants