Bundle Size / Nuxt: Why is vue-server-renderer included in Nuxt Frontend Build
See original GitHub issueBug 🐞
What is the current behavior?
Go to the folder examples/nuxt.
Add the following script to package.json
"analyze": "nuxt build --analyze"
This is the output:
The vue-server-renderer with the size of 334KB is added to the frontend bundle!
What is the expected behavior?
vue-server-renderer/basic.js should not be part of the Frontend Build in nuxt.js. It is part of nuxt.js anyway and not used in the frontend.
Does this happen only in specific situations?
No it happens always. Even on the commited example.
What is the proposed solution?
I have no idea.
What is the version you are using?
4.8.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Bundle Size / Nuxt: Why is vue-server-renderer included in Nuxt ...
What is the current behavior? Go to the folder examples/nuxt. Add the following script to package.json "analyze": "nuxt build --analyze". This ...
Read more >Server-side rendering with Vue and Nuxt.js - LogRocket Blog
Learn about server-side rendering (SSR) and client-side rendering (CSR), how its evolved, and how to use implement it with Nuxt.js and Vue.
Read more >Nuxt Server Side Rendering vs Pre-rendering
When using this method to build your app, Nuxt goes through each page in your project and renders them into an HTML file...
Read more >Vue and Nuxt Performance Optimization Checklist
Find the size of any javascript package and its effect on your frontend bundle. Make sure to use libraries that support tree shaking...
Read more >Server Side Rendering - Nuxt
Server -side sends a fully rendered page to the client; the client's JavaScript bundle takes over which then allows the Vue.js app to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve looked through the code a bit and do not see any reason why webpack wouldn’t bundle vue-server-render. I guess this is the critical statement here:
I do not know how to fix it at the core, but I worked around it with some additional config:
In your nuxt config under build (https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-build#extend):
The dependency is gone from the front-end and SSR still works.
Edit: I forgot to mention you also have to import webpack in your nuxt.config.js:
import webpack from 'webpack'
Unfortunatly this does not work for me. On Nuxt I have to include AisInstantSearchSsr instead of AisInstantSearch . I tried to import it as you said but the bundle size is the same:
import AisInstantSearchSsr from 'vue-instantsearch/es/src/components/InstantSearchSsr.js'
As soon as I have this dependancy the build in frontend adds the view renderer. Any other ideas? These unneeded 334kb hurt so much in the frontend.