-
-
Notifications
You must be signed in to change notification settings - Fork 537
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
Error Class extends value undefined is not a constructor or null
occurs after the version upgrade from 0.49.2 to the latest version
#1539
Comments
Class extends value undefined is not a constructor or null
occurs after the version upgrade from 0.49.2Class extends value undefined is not a constructor or null
occurs after the version upgrade from 0.49.2 to the latest version
I experienced this when transitively importing |
I came across this same issue in Remix. I fixed it by doing this: if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {
const { server } = require('./mocks/server');
server.listen();
} The |
@JimLin94 I ran into this as well. Going through the call stack, it looks like AsyncEventEmitter.js is an iife, and it's called with
Installing the older version - |
I can confirm, same issue as @dustinmyers msw@1.1.0 |
same issue in msw@1.1.1, downgrading to 49.2 fixes the problem but msw cant be updated to typescript 5.0 |
Same happens here. A bit of a mess. I will rollback to 0.49.2 and wait :) |
for me this seams like a different issue: |
Thanks for the insights, everyone. The root cause seems to be for the |
The issue is reproducible in The only change in |
HI, any updates regarding this? thank you! |
Just did a fresh install of msw and encountered this. The latest versions are broken this way out of the box, at least for some systems. |
is it possible to revert the changes from v0.49.3, it affects a lot of users, for us this is an update blocker for ts 5 |
@dustinmyers is correct regarding this: there are conflicting versions of In any case, I think we should release yet another backport to Interceptors where we update |
How to solve thisI've opened a work-in-progress fix at mswjs/interceptors#382. It requires quite a lot of changes to adopt the old version of Interceptors (0.17.9) to the newer I'm sorry to everyone blocked by this but I don't have the capacity to dive into a week of refactoring to support a backport version. MSW 1.x is stale as I wrote countless times on Twitter, and I highly encourage you to update to I wish I had more time to handle these projects with proper care, providing backport fixes and such. I simply don't. I know it will make people sad but that's the reality. You can change it, instead of being sad, by Sponsoring MSW. If you are blocked by this, this is the best time to migrate to |
I'm writing this now mostly for learning purposes since I found the problem really interesting and want to understand more how dependency resolution in this case works - I hope that is ok! To sum up first: As others already pointed out, the problem is that What puzzles me is that when I create a fresh project with CRA and install the latest version of The
So in both cases it looks fine to me! In the non-working app it seems now that node, when resolving the dependency in I would expect that node searches for
As compared to in the working, fresh CRA app:
Consequently, when I change the line where
to the relative path
it is importing the correct version and works as expected. Does anybody understand why node (or any other involved tooling) is changing module.paths from one app to another? Or point me to any learning material that could help to further understand the problem? |
Prerequisites
Environment check
msw
versionBrowsers
Chromium (Chrome, Brave, etc.)
Reproduction repository
private code i am not allowed to share
Reproduction steps
I run into the error during the runtime after the MSW.js version upgrade.
It happens to the version between v0.49.3 to v1.0.1.
All the version 0.49.3 works fine before v0.49.3 for me.
Current behavior
package.json contains:
"msw": "1.0.1",
The entry point of the development mode.
index.dev.tsx
.The file handles the worker.
The file handles the handlers
Expected behavior
Working properly.
The text was updated successfully, but these errors were encountered: