ctwhome / top-nuxt3

Full stack Nuxt 3 Template starter with Supabase and Tailwindcss
https://top-nuxt3.netlify.app
115 stars 17 forks source link

`pwa-build.ts` not working? #3

Open userquin opened 2 years ago

userquin commented 2 years ago

I have it working, what's the problem here? I use pnpm, I update my fork and run the build script again, updating the build pwa script.

imagen

PMLS3 commented 2 years ago

@userquin how did you make it work?

ctwhome commented 2 years ago

thanks @userquin for the effort. I need to check it out better, It wasn't registering the manifest, so not showing the app name, icons etc. I am gonna have a look at it today

PMLS3 commented 2 years ago

@ctwhome also got the same error... on built it doesnt take the css (windicss) when I uncommented the build-pwa.ts

PMLS3 commented 2 years ago

@ctwhome Did you manage to find a solution? Been trying the last couple of days but no success...

PMLS3 commented 2 years ago

start_url works in development but when deployed it doesn't... not sure why

ctwhome commented 2 years ago

I can't find the problem either ☹️

userquin commented 2 years ago

@PMLS3 where are you deploying the app (vercel, netlify, custom server)? beware, the app needs a server middleware for some resources, just check the nuxt module added and maybe you cannot use it on your deployment.

Can you also provide some more input? some log and some screenshots for output build directory.

userquin commented 2 years ago

Right now, there is no static site generation available on nuxt3 so you must deploy the nuxt3 app and start the server module, I think.

As I mention on pwa plugin repo it is a POC and we should wait to nuxt team solution. It should work on local, but it is not ready for production (I mean to be deployed on production environment).

userquin commented 2 years ago

some more inputs: I built it using node 16.11.0 LTS

ctwhome commented 2 years ago

In my case, I just serve it on Netlify. I am just thinking if the middleware could be hosted as a cloud function on vercel or netlify. Thanks for the response!

ctwhome commented 2 years ago

I think we should close this issue and leave the comments on the readme of the template

PMLS3 commented 2 years ago

@PMLS3 where are you deploying the app (vercel, netlify, custom server)? beware, the app needs a server middleware for some resources, just check the nuxt module added and maybe you cannot use it on your deployment.

Can you also provide some more input? some log and some screenshots for output build directory.

I am deploying it to Google Cloud with Dockerbuild docker

PWA results by Lighthouse pwa

@userquin when I build local and run npm run start, the start_url gets picked up...

UnhandledPromiseRejectionWarning: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/src/app/.output/server/chunks/client.manifest.mjs' imported from /usr/src/app/build-pwa.ts

Might be what is wrong when I went through the build log:

userquin commented 2 years ago

@PMLS3 uhmm, can you check the file is there? it seems the error comes from using the dynamic import to load the client manifest to add the pages to the sw precache manifest.

EDIT: I mean, this file exists => /usr/src/app/.output/server/chunks/client.manifest.mjs

userquin commented 2 years ago

the build log cannot be downloaded

userquin commented 2 years ago

@PMLS3

Be sure you have at least node v14.17.0 (I recommend at least 14.18.0), with node 16.11.0 LTS I have not that problem. Just check node --version on your deploy.

On your local is it working (build + serve)?

PMLS3 commented 2 years ago

@PMLS3

Be sure you have at least node v14.17.0 (I recommend at least 14.18.0), with node 16.11.0 LTS I have not that problem. Just check node --version on your deploy.

On your local is it working (build + serve)?

Yes local build + serve works 100%, trying to figure out where to see my build files on google cloud. Will let you know about the file as soon as I get it. Will try up my Dockerfile to use node v-16

PMLS3 commented 2 years ago

the build log cannot be downloaded

@ctwhome sorry, here is the txt build log.txt

PMLS3 commented 2 years ago

@ctwhome Can you see if /usr/src/app/.output/server/chunks/client.manifest.mjs has build on yourside?

ctwhome commented 2 years ago

nope, nothing there image

PMLS3 commented 2 years ago

nope, nothing there

image

@userquin seems like it doesn't build with the file. Do you perhaps know why it doesn't. Locally it builds fine

userquin commented 2 years ago

@PMLS3 maybe you can ask on nuxt repo