IlyaSemenov/nuxt-vite-legacy

nuxt-vite-legacy returns unexpectedly

Closed this issue · 3 comments

The console displays:

 WARN  nuxt-vite-legacy didn't find legacy-polyfills-legacy chunk. Legacy build will not work. 

But I only use vite-plugin-legacy to generate modern polyfills in my project with renderLegacyChunks: false in config. The plugin should still mutate the reference in the manifest instead of aborting.

Can you please elaborate? Which reference should be mutated and how?

Firstly I don't understand why renderLegacyChunks is omited.

// Copy of @vitejs/plugin-legacy options type, with renderLegacyChunks and externalSystemJS omitted.

Some users (like me) generate polyfills via vite-plugin-legacy for modern but old browsers (like chrome 69).
The config is generally like the following one:

legacy({
  modernPolyfills: true,
  renderLegacyChunks: false,
}),

With the above config, manifest key of polyfills is vite/legacy-polyfills, instead of vite/legacy-polyfills-legacy in source code:

key.endsWith("/legacy-polyfills-legacy")

'vite/legacy-polyfills':
   { resourceType: 'script',
     module: true,
     prefetch: true,
     preload: true,
     file: 'polyfills.b7972713.js',
     isEntry: true,
     src: 'vite/legacy-polyfills' } }

Fair point, this use case didn't occur to me. This was addressed in version 1.1.0.