-
-
Notifications
You must be signed in to change notification settings - Fork 469
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
Throw when run in production #1703
Comments
@kentcdodds hi, 👋 Do you have any considerations I may be not seeing in regard to this feature? How would this impact your and your students' experience, for example? |
The opt-out is sufficient for me. This looks great. |
scr2em
pushed a commit
to scr2em/msw
that referenced
this issue
Oct 23, 2023
scr2em
added a commit
to scr2em/msw
that referenced
this issue
Oct 23, 2023
scr2em
added a commit
to scr2em/msw
that referenced
this issue
Nov 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scope
Adds a new behavior
Compatibility
Feature description
I propose MSW, both
setupWorker
andsetupServer
throw an exception when detected being run inNODE_ENV === 'production'
.Motivation
When MSW gets to a production environment that's a mistake on the developer's end 9 times out of 10. I believe this would be a good default behavior to have to prevent this kind of mistake.
Implementation
Apart from raising an exception, this feature should also introduce an opt-out mechanism for those who explicitly wish to run MSW in production. We must still permit to run MSW anywhere the end user want but they need to explicitly state their intention. I know that a lot of teachers rely on MSW in production to teach their workshops. I want them to keep doing that without hindrance.
When the
dangerouslyRunInProduction
is provided and equalstrue
, suppress the said exception.The text was updated successfully, but these errors were encountered: