-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
webpack 5: Failed to parse source map from "@mswjs/interceptors" #1030
Comments
I've the same warning after updating create react app. I see the warnings after npm start. All the warning are about @mswjs/interceptors at least for me. I tried to rebuild the module but didn't help. |
Hey, @JoeyAtSS. Thanks for reporting this. It looks like the issue is coming from the sourcemaps for the // node_modules/@mswjs/interceptors/lib/interceptors/fetch/index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interceptors/fetch/index.ts"],
I don't think this is an issue with the library itself, as we haven't changed our bundling process in a while. It may be an indirect issue of webpack5 behaving differently, to which we have to find a proper way to adjust. One thing I'm not certain about is why webpack attempts to require modules from the sourcemaps. To my best knowledge, sourcemaps link the compiled and source code to ease your debugging whenever the former has any issues. I wouldn't expect the source module references to be imported. |
I have a suspicion that CRA5 should configure webpack to ignore source maps from |
Hello, The source map files links to the src/ - folder that is not distributed. // node_modules/@mswjs/interceptors/lib/interceptors/utils/uuid.js.map
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../-->src<--/utils/uuid.ts"] ...} In the source-map-loader README it says: "The source-map-loader will extract from any JavaScript file, including those in the node_modules directory.". As for CRA 5: I'm seeing these warnings when starting the dev server using |
In case someone is lost on how to do it, just add the
|
For Windows Users 🚀🤘Create an environment variables file named OR Run "scripts": {
"start": "cross-env GENERATE_SOURCEMAP=false react-scripts start"
} |
What I'd like to understand better is whether this sourcemap behavior is specific to CRA or happens on clean webpack apps? If it's specific to CRA then it needs to be addressed when using CRA (i.e using the Please, would somebody have time to spin up a clean webpack app to check this? |
- Fixes warnings: [Failed to parse source map from](mswjs/msw#1070) - mswjs/msw#1030
I can confirm this occurs with a clean webpack setup |
I guess it's just a matter of including ./src in Line 44 in ddbc5a7
|
@atti187, absolutely. Would you like to open a pull request in the interceptors repo? |
Sure, I'll look into it. Give me a few days to sort out a little time. |
Meanwhile, source-map-loader can be configured to exclude @mswjs like this (keeping current excludes used in CRA5):
|
Issue and fix described here: mswjs/msw#1030 (comment)
This is a known issue in the Interceptor project of MSW. See workaround here: mswjs/msw#1030 (comment)
@jimwilde, that error suggests you're trying to bundle It's evident from your stack trace:
You can see how I highly suggest to take a look at the directory structure in one of our examples to avoid this mistake. |
You were, of course, entirely correct in your diagnosis. Followed your suggested directory structure and all sorted. Thanks for the prompt response. Much appreciated! |
Note to me that this will require a minor version bump, as |
🎉 This issue has been resolved in version 0.38.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
webpack 5: Failed to parse source map from "@mswjs/interceptors" Modeled after: mswjs/msw#1030 mswjs/interceptors#204
webpack 5: Failed to parse source map from "@mswjs/interceptors" Modeled after: mswjs/msw#1030 mswjs/interceptors#204
NOTE! Source maps generated in Webpack under react-scripts are busted. mswjs/msw#1030 GENERATE_SOURCEMAP=false
Alternatively, you can add GENERATE_SOURCEMAP=false to a .env file |
Describe the bug
New webpack 5.0 throwing compilation error regarding source map not found
there are multiple of these, but for the sake of simplicity, i just pasted one of it.
Environment
msw: 0.36.3
nodejs: 14.18.2
npm: 8.3.0
To Reproduce
Steps to reproduce the behavior:
Expected behavior
should not have these warning errors.
Screenshots
The text was updated successfully, but these errors were encountered: