Service Worker registration error: Unsupported MIME type ('text/html')

前端 未结 12 1335
梦如初夏
梦如初夏 2020-12-05 17:44

I\'m using create-react-app with an express server.

create-react-app has a pre-configured ServiceWorker that caches local assets (https://github.com/fac

12条回答
  •  没有蜡笔的小新
    2020-12-05 18:08

    In my case, for Vue I needed to generate the mockServiceWorker.js in the public directory using the command-line tool as described here:

    https://mswjs.io/docs/getting-started/integrate/browser

    This was not clear from the samples to me. Specifically the CLI command to run is:

    npx msw init ./public
    

提交回复
热议问题