Comments (5)
@haleksandre have you configured kit sw entry? https://vite-pwa-org.netlify.app/frameworks/sveltekit.html#generate-custom-service-worker
Latest kit pwa plugin version will delegate sw build to kit, and so you need to configure src/sw.ts
in the kit config file. CHECK the entry in the docs, you will need to include/change a few things.
from sveltekit.
Yes, my svelte.config.js
config is like so
import adapter from "@sveltejs/adapter-node";
import preprocess from "svelte-preprocess";
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(),
kit: {
adapter: adapter({ out: "dist" }),
env: {
publicPrefix: "API_URL",
},
serviceWorker: {
register: false,
},
files: {
serviceWorker: "src/sw.ts",
},
csrf: {
checkOrigin: process.env.NODE_ENV !== "development",
},
},
};
export default config;
It is peculiar that everything is building fine on my local using the exact same configs, files within the same image, and environment variables, but fails in the GitLab CI.
from sveltekit.
Can you show the gh pages output/dist folder?
from sveltekit.
Check if the output folder inside .sveltekit contains service-woker.js or sw.js (ot seems former is missing)
from sveltekit.
Turns out it was indeed an error caused by an environment variable. I did not realize that I had forgotten to add a .dockerignore
file in the root, so the building process had access to the .env
file when building locally on the host & inside a Dockerfile. On the CI, there were not such files so the imports of $env/static/private
variables were throwing errors, as they did not exist. Svelte Kit was throwing errors but SvelteKitPWA wasn't catching them. It then tried to build regardless but then itself was throwing an error because the directory of the previous build process was missing. Perhaps add in the build process a way to catch & throw previous build step errors, if possible?
Anyways, thanks for taking the time to help me troubleshoot this issue. 👍
from sveltekit.
Related Issues (20)
- Having an issue with ssr = false HOT 8
- Issues with SPA HOT 1
- Inject Register script or inline has no effect on output HTML. HOT 6
- [Info] Cloudflare Adapter Routes misses vite-pwa HOT 1
- Cannot find module 'virtual:pwa-info' or its corresponding type declarations HOT 26
- Importing 'virtual:pwa-register' causes bug on build HOT 3
- Make client Javascript work offline HOT 2
- Deprecated packages HOT 2
- Uncaught (in promise) non-precached-url: non-precached-url :: [{"url":"/"}] HOT 13
- Navigating to SvelteKit error page after a new build causes infinite page reload loop HOT 6
- Uncaught ReferenceError: process is not defined for injectManifest HOT 1
- Error: [InjectManifest] 'plugins' property is not expected to be here. HOT 1
- Support Node v20 HOT 1
- Uncaught SyntaxError: Unexpected token 'export' HOT 3
- `_app/version.json` should be included in sw precache manifest
- Please document that images that are outside of `/static` will NOT build in production HOT 2
- Workbox responses with cached data for network only requests HOT 20
- One of the glob patterns doesn't match any files HOT 6
- Please provide a minimal example
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 sveltekit.