bridge icon indicating copy to clipboard operation
bridge copied to clipboard

Serve modern format with bridge and vite

Open danielroe opened this issue 2 years ago • 1 comments

Currently the vite implementation in Bridge diverges somewhat from within Nuxt 3. This is a problem for a couple of different reasons.

  1. it increases the maintenance burden and doubles potential bug-surface
  2. it is misleading for people migrating to nuxt 3, because the experience and compatibility is subtly different

One example is using @vitejs/plugin-legacy. The context for using it is the need for native ES module support in browsers. Otherwise, adopting vite for Nuxt 2 would mean unsupporting browsers that historically Nuxt 2 has supported. See browser support table on MDN.

I propose we align the implementations of vite in both Bridge & Nuxt 3, including (where possible) either removing use of @vitejs/plugin-legacy or porting it to the Nuxt 3 vite implementation.


Related issues with @vitejs/plugin-legacy

  • [ ] it will be tricky to add support for dynamic base urls - seen whilst tackling nuxt/bridge#89
  • [ ] the polyfill is loaded async which means it may not have been executed before entry, leading to a fatal error: nuxt/bridge#129 - solution in separate PR

danielroe avatar Mar 17 '22 13:03 danielroe

so how to resolve it

Jackliu007888 avatar Mar 23 '22 15:03 Jackliu007888