N
Nuxt2y ago
MaxT

SSG and the size of entry.js file

Hello, I am on the stable version of NUXT3. When I don't have the pages folder, and only have the app.vue file, the output of run npm generate produces the entry.randomchars.js file with the size of 33.7 kb gzipped. If I delete the app.vue file, and create the pages/index.vue page with the same exact content (just a single paragraph) and do a generate - the size of that file goes up to 50 kb gzipped. If I create another page, like pages/about.vue and generate again, the file size goes up even hight. Why is that happening? I am not even using any components that would need any hydration on the client. Shouldn't the file stay fixed at the same 33.7 kb to include the runtime for Vue3 and Nuxt3? Why is it growing in size? Thank you!
13 Replies
harlan
harlan2y ago
Once you add a page Nuxt will include vue-router for you you can use nuxi analyze to see where the bytes are coming from
MaxT
MaxTOP2y ago
I will check. Why would the router be included for SSG? Isn't that needed for SPA/Hybrid instead of MPA (that is fully static)?
harlan
harlan2y ago
full static doesn't mean no router, it just means there's no server to talk to and payloads are saved if you want no SPA like features then you can remove all scripts
harlan
harlan2y ago
GitHub
GitHub - danielroe/nuxt-zero-js: Remove all client-side JS from you...
Remove all client-side JS from your Nuxt 3 app. Contribute to danielroe/nuxt-zero-js development by creating an account on GitHub.
MaxT
MaxTOP2y ago
You are right. The router is being added. So there is no way to disable this behavior? I still need javascript for components. I just don't need client-side routing for a MPA. Basically I just need the vue runtime loaded and the rest of the javascript lazy-loaded when islands come in 3.1 (or using a plugin). No need for client side routing Thanks for the explanations by the way. I am brand new to Nuxt, coming from Next.js
harlan
harlan2y ago
I don't think there's a way to opt out of it It would break core nuxt logic likely You could get around the issues but you would need make a custom pre-renderer btw if you want to use islands rn you can use the edge release channel and enable it
MaxT
MaxTOP2y ago
I tried doing the edge channel, but it didn't pull in a new version I was probably doing something wrong
harlan
harlan2y ago
hm ye not sure, working fine for me i just built something using islands, their pretty nice
MaxT
MaxTOP2y ago
I put this in my package.json "nuxt": "npm:nuxt3@latest" deleted the lock file did npm i and didn't see the experimental flag for islands in nuxt config file 😄
harlan
harlan2y ago
you would need to run nuxt or do nuxt prepare for the types to be updated possibly
experimental: {
componentIslands: true,
},
experimental: {
componentIslands: true,
},
MaxT
MaxTOP2y ago
it still shows as 3.0.0 when I do npm i npm run postinstall which runs nuxt prepare doesn't seem to make a difference 😦 I was able to get it working wiht a new project. Not sure why it wasn't upgrading the original one. 😮
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
MaxT
MaxTOP2y ago
I couldn't figure out how it's supposed to work, since there is no documentation yet....I played around with Next.js 13 instead 😄 I'll revisit once Nuxt 3.1 and Vue 3.3 are out.
Want results from more Discord servers?
Add your server