Should I Source Control public/mockServiceWorker.js #1015
-
So I am wondering if I should be putting |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hey, @jrock2004. That's a great question. Our stance on whether you should commit the worker script to your VCS has changed over time. In the past, the worker script was generated only by using the Now, I recommend setting up the {
"msw": {
"workerDirectory": "./public"
}
} With this property set, the worker script will automatically be generated whenever you install |
Beta Was this translation helpful? Give feedback.
Hey, @jrock2004. That's a great question.
Our stance on whether you should commit the worker script to your VCS has changed over time. In the past, the worker script was generated only by using the
npx msw init
command. That's why we used to recommend committing the script so that everybody working on your project would be sure they're using the same worker implementation.Now, I recommend setting up the
msw.workerDirectory
property in your "package.json":With this property set, the worker script will automatically be generated whenever you install
msw
. This automatization allows you to treat the worker script as an artifact and omit i…