Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge & Vite: Do not load all chunks at the same time #1126

Closed
hamedniroomand opened this issue Feb 28, 2024 · 3 comments · Fixed by #1164
Closed

Bridge & Vite: Do not load all chunks at the same time #1126

hamedniroomand opened this issue Feb 28, 2024 · 3 comments · Fixed by #1164

Comments

@hamedniroomand
Copy link

Environment

  • Operating System: Darwin
  • Node Version: v20.11.0
  • Nuxt Version: 2.17.3
  • CLI Version: 3.10.1
  • Nitro Version: 2.8.1
  • Package Manager: yarn@1.22.21
  • Builder: vite
  • User Config: target, ssr, bridge, features, build, spaloadingtemplate, components, head, serverHandlers, devServerHandlers, devServer, typescript, nitro, buildModules
  • Runtime Modules: -
  • Build Modules: (), @nuxt/bridge@3.0.1

Reproduction

https://github.com/hamedniroumand/nuxt-bridge-sample

Describe the bug

image

I have a nuxt bridge project consisting of three pages that are linked to each other, each utilizing the no-prefetch prop in all links. However, upon generating and starting the project, all chunks related to my pages and components are loaded in a single location, rather than loading only the chunks relevant to the currently opened page.
Consequently, this leads to unused component styles from other pages being loaded on the main page, resulting in unnecessary bloat and potential styling conflicts.

Additional context

This issue is not present in Nuxt 3, suggesting a discrepancy in behavior between the versions.

If you set isAsync: true inside the components configs, this issue be solved only in dev mode.

Logs

No response

@marcos-vinicius-dev
Copy link

marcos-vinicius-dev commented Mar 8, 2024

I have the same error: Nuxt 2.17.3 with Nitro 2.9.1

I tested with nitro using dev script: 'nuxi dev'. When accessing http://localhost:3000/inspire, I have assets from the http://localhost:3000/index page being loaded, vice versa...

Captura de tela 2024-03-08 122706

Repository - https://github.com/marcos-vinicius-dev/nuxt-bridge/tree/main
Demo: https://nuxt-bridge.vercel.app/

@AndreyYolkin
Copy link
Contributor

This is happened because bridge utilises Legacy Plugin and generates manifest with SystemJS. I gave more details here: https://discord.com/channels/473401852243869706/992155295927251074/1171782196974075984

Maybe it's good time to raise the question again

@wattanx
Copy link
Collaborator

wattanx commented Mar 25, 2024

We have added an option to not use @vitejs/plugin-legacy.
It will be released with Nuxt Bridge 3.2.0!
(If you want to use it quickly, it is available after bridge-edge@3.1.0-28522654.a6eae9b.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants