Comments (9)
@inspiredlabs Yes there are some incompatibilities with the new sveltekit. I have done fixes on a local copy so far but have been a bit too busy to complete a clean work to push back. Hopefully, I'll find time this weekend. I'll try to give more info on here in a few hours if you want to put them in by hand yourself in your project.
from sveltekitpwa.
I have a working local fixed version. I need to check it works correctly as a PWA and then I will push it.
PS: I pushed it but cannot deploy it to Vercel for testing. It builds correctly locally but not on Vercel.
from sveltekitpwa.
PS: I pushed it but cannot deploy it to Vercel for testing. It builds correctly locally but not on Vercel.
I got the deployment working on Vercel following a Sveltekit installation and merge – see: app.html
now has %sveltekit.things%
as opposed to %svelte.things%
.
Although now dev tools Lighthouse throws:
__layout.svelte-06035f0d.js:2 cannot register service worker DOMException: Failed to register a ServiceWorker for scope ('https://inspectort.vercel.app/') with script ('https://inspectort.vercel.app/service-worker.js'): Operation has been aborted
(anonymous) @ __layout.svelte-06035f0d.js:2
inspectort.vercel.app/:1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://inspectort.vercel.app/') with script ('https://inspectort.vercel.app/service-worker.js'): Operation has been aborted
It works!
NB: there are two requirements here:
import { build, files, timestamp } from '$service-worker';
has been deprecated.package.json
req."svelte": "^3.48.0"
and"@types/cookie": "^0.5.1"
, see: https://github.com/inspiredlabs/inspector/commit/1102018472b0e1edacf96be6027ad7ab5467e9f0#diff-0aba05b7e68a2bb0e8cebbd6297fafc218eaeff08345a12bd379181c4a88e454- Lighthouse demo: https://inspectort.vercel.app/
from sveltekitpwa.
Two things:
- Can you create a pull request with the fixes you list?
- My inability to test it seems to be a known issue. I emailed vercel's support asking how to create a fresh or clean deployment but have not yet heard from them Your deployment works because it is a fresh deployment, I presume. Mine, trying to update the existing one, fails. See this post in a thread on the subject about it: sveltejs/kit#4135 (comment)
PS: Third thing, I am not seeing %svelte.things%
in the code. Is that something purely of yours? I did change a few svelte
into sveltekit
, but not with things
.
from sveltekitpwa.
PS: Third thing, I am not seeing %svelte.things% in the code. Is that something purely of yours? I did change a few svelte into sveltekit, but not with things.
Mea culpa, for the shorthand, what I meant was: %sveltekit.head%
and %sveltekit.body%
from this working version of SveltekitPWA which has %svelte.head%
and %svelte.body%
, obv. this no longer works as it did. Which you changed.
from sveltekitpwa.
A PR won't work as there are many changes to Sveltekit.
Here's how to get it working:
- start a new project, which will deploy to Vercel OOTB.
- open the contents of your zip:
~/SveltekitPWA-main
, and merge the following:- your up-to-date project files (
hooks.js
,ReloadPrompt/index.svelte
, etc). svelte.config.js
and comment outtarget: '#svelte',
- OPTIONAL: I also added:
const config = { experimental: { inspector: true }, ... }
, tosvelte.config.js
, although this doesn't affect the offline capabilities. - open
app.html
and ensure%sveltekit.head%
and%sveltekit.body%
are there. - replace instances of
timestamp
withversion
in service-worker.ts - update your
package.json
, as per this: package.json. npm install
- you might need to update:
npm install --save core-js@^3
separately.
- you might need to update:
npm build && npm run preview
- deploy to Vercel with a temporary name, and test it works.
- delete your old "nice-name" deploy and redeploy with the nice-name.
- your up-to-date project files (
Feel free to clone this public repo, if I have missed something in the instructions.
from sveltekitpwa.
I have done some changes to the config.json and it seems it does address my deployment issues. I will push the changes after a bit of clean up.
from sveltekitpwa.
The changes have been pushed. Unless you see anything else, I will close this issue tomorrow.
from sveltekitpwa.
Closing this issue.
from sveltekitpwa.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sveltekitpwa.