Preact
The Preact example project can be found on examples/preact-router package/directory.
The router used on this example project is preact-router.
The Preact example has been created using create-vite template with pnpx:
pnpx create-vite
shell
pnpx create-vite
+ create-vite 2.6.6
√ Project name: ... preact-router
√ Select a framework: » preact
√ Select a variant: » preact-ts
Scaffolding project in examples\preact-router...
Done. Now run:
cd preact-router
npm install
npm run dev
pnpx create-vite
+ create-vite 2.6.6
√ Project name: ... preact-router
√ Select a framework: » preact
√ Select a variant: » preact-ts
Scaffolding project in examples\preact-router...
Done. Now run:
cd preact-router
npm install
npm run dev
To test new content available, you should rerun the corresponding script, and then refresh the page.
Executing the examples
WARNING
Before following the instructions below, read the Contribution Guide.
Make sure you install project dependencies, and build the repo on your local clone/fork:
shell
cd vite-plugin-pwa
pnpm install
pnpm run build
cd vite-plugin-pwa
pnpm install
pnpm run build
To run the examples, execute the following script from your shell (from root folder), it will start a CLI where you will select the framework and the pwa options:
shell
pnpm run examples
pnpm run examples
If you don't run pnpm build first, you may see an error like, failed to load config or Please verify that the package.json has a valid "main" entry.
generateSW
generateSW has the following behaviors:
Prompt for update:- Show
Ready to work offlineon first visit and once theservice workerready. - Show
Prompt for updatewhen newservice workeravailable.
- Show
Auto update:- Show
Ready to work offlineon first visit and once theservice workerready. - When new content available, the service worker will be updated automatically.
- Show
Prompt for updatewithPeriodic service worker updates:- Show
Ready to work offlineon first visit and once theservice workerready. - Show
Prompt for updatewhen newservice workeravailable. - The example project will register a
Periodic service worker updates
- Show
Auto updatewithPeriodic service worker updates:- Show
Ready to work offlineon first visit and once theservice workerready. - The example project will register a
Periodic service worker updates - When new content available, the service worker will be updated automatically.
- Show
injectManifest
injectManifest has the following behavior:
Prompt for update:- Show
Ready to work offlineon first visit and once theservice workerready. - Show
Prompt for updatewhen newservice workeravailable.
- Show
Auto update:- Show
Ready to work offlineon first visit and once theservice workerready. - When new content available, the service worker will be updated automatically.
- Show
Prompt for updatewithPeriodic service worker updates:- Show
Ready to work offlineon first visit and once theservice workerready. - Show
Prompt for updatewhen newservice workeravailable. - The example project will register a
Periodic service worker updates
- Show
Auto updatewithPeriodic service worker updates:- Show
Ready to work offlineon first visit and once theservice workerready. - The example project will register a
Periodic service worker updates - When new content available, the service worker will be updated automatically.
- Show