chore: service worker as a Vite environment#15614
chore: service worker as a Vite environment#15614
Conversation
|
| * @default true | ||
| */ | ||
| register: true; | ||
| register?: true; |
There was a problem hiding this comment.
This fixes a type issue where you can't specify options unless you specifically set register: true although that's the default
|
|
||
| test.describe('Service worker', () => { | ||
| if (process.env.DEV) { | ||
| test('import proxy /basepath/service-worker.js', async ({ request }) => { |
There was a problem hiding this comment.
We don't need this test anymore because we're not proxying the worker. We're transforming the entry file using the service worker environment and returning the transformed code.
This PR refactors the service worker code so that it utilises the Vite environment API. This means it:
This PR also does a little cleanup such as:
applyEnvironmenthooks below theconfighook since they only get applied after them (therefore,applyEnvironmentdoes not influence whetherconfigis run.)Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits