Closed rantiev closed 2 years ago
Hi, @rantiev.
In our Angular example, we enable Mock Service Worker as a part of the application's environment. Here you can see what the worker
is imported and started in the development environment:
I believe Angular loads this environment by default so you don't have to explicitly state that. Then, in the entry module, we enable the production environment conditionally:
The production environment does not import or start the worker, so there's no API mocking in production.
This is a setup specific to Angular and has been prepared for developers working with Angular much closer than I ever have. I think it makes sense but if you find it confusing feel free to propose how we would improve it. Thanks.
To begin with, I think we can update the README.md
to explain that we couple mocking with the environment. @rantiev, would you be interested in opening a pull request with that change?
docs says -> src/main.ts conditionally enables mocking in development environment.
But where is it there?