Mock Service Worker
  1. Recipes
  2. Usage with CDN

Usage with CDN

Pick a suitable CDN that can serve NPM modules and include the respective script in your page. See the examples of how to integrate Mock Service Worker using a few popular CDNs below.


1<script src=""></script>


1<script src=""></script>

Place the Service Worker

To copy the Service Worker into your public directory, use the npx msw init command:

1$ npx msw init <PUBLIC_DIR>