Comments (4)
@logotip4ik I'll review latest changes in Nuxt, it is weird, mode should be production and injectManifest
should minify the sw (the pwa plugin includes process.env.NODE_ENV="production"
via Vite define option in the custom build): https://github.com/vite-pwa/vite-plugin-pwa/blob/main/src/modules.ts#L95
from nuxt.
@logotip4ik found the problem:
- by default Vite will use
esbuild
to minify, since we're using a custom Vite build to build the service worker, Vite will useesbuild
since pwa plugin will not provide/change thebuild.minify
option vite-plugin-pwa
is usinges
as default Rollup format to build the service worker, but Vite will not remove empty spaces https://vitejs.dev/config/build-options.html#build-minify:Note the build.minify option does not minify whitespaces when using the 'es' format in lib mode, as it removes pure annotations and breaks tree-shaking.
You can change the format using iife
, the service worker is minified but the code generated is wrong and will not work.
You can check it here in this SB fork : https://stackblitz.com/edit/nuxt-starter-al3pyt?file=nuxt.config.ts.
If you run yarn build
the output will be on server/public
folder, I've changed nitro output.dir
and there is an issue on nitro about custom output (also tried with terser plugin with no luck).
from nuxt.
anyway, your sw has errors: missing race
and debug
variables and error in L55
from nuxt.
anyway, your sw has errors: missing
race
anddebug
variables and error in L55
I thought that they would be somehow inlined at the build time 😅. I took this example from vite-pwa website (https://vite-pwa-org.netlify.app/workbox/inject-manifest.html#network-first-strategy). Should i open pr to fix this ?
from nuxt.
Related Issues (20)
- How to disable caching "_nuxt" folder due to "The server responded with a status of 429" after every update!!! HOT 4
- How to use it with useAsyncData? HOT 1
- Service worker keeps showing 'trying to install' when using `app.baseURL` under injectManifest strategy HOT 1
- Importing the virtual module in a unit test with Vitest HOT 2
- npm WARN when run "npm i @vite-pwa/nuxt -D" HOT 3
- [Feature Request]: dynamic manifest.json via nitro HOT 2
- pwa does not cache data in Nuxt 3 SSR HOT 3
- Firefox injectManifest not working HOT 1
- Cannot find module '#pwa' or its corresponding type declarations. HOT 2
- vite-pwa/nuxt not working on ios
- Module does nothing ? (EDIT: No Firefox support ?) HOT 9
- Nuxt3 + PWA warnings in terminal HOT 6
- cant use npm run build
- I can't get 'start_url' to work for me
- showInstallPrompt not being called HOT 1
- Uncaught ReferenceError: __NUXT_ASYNC_CONTEXT__ is not defined HOT 7
- Service Worker "import sentry-release-injection" error when loading page HOT 19
- @vite-pwa/nuxt and vue-tsc conflict HOT 4
- API Request URLs Open in New Tab Redirect to 404 Page HOT 2
- Generate PWA Assets functionality not works when srcDir is not default HOT 15
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 nuxt.