javascriptvitepolyfills

How to let vite print the functions that are polyfilled for the production build?


This bug report includes the following output from vite:

vite v2.9.9 building for production...
✓ 4 modules transformed.
rendering chunks (1)...[@vitejs/plugin-legacy] modern polyfills: Set(4) {
  'core-js/modules/es.array.iterator.js',
  'core-js/modules/web.dom-collections.iterator.js',
  'core-js/modules/es.promise.js',
  'core-js/modules/es.regexp.exec.js'
}
dist/assets/favicon.17e50649.svg           1.49 KiB
dist/index.html                            0.53 KiB
dist/assets/index.e9192aae.js              0.91 KiB / gzip: 0.53 KiB
dist/assets/index.06d14ce2.css             0.17 KiB / gzip: 0.14 KiB
dist/assets/polyfills-modern.e9f39d78.js   34.19 KiB / gzip: 14.12 KiB

However, npx vite build does not print the lines that describe what functions are polyfilled. How should I let vite print this information?


Solution

  • With DEBUG=vite:legacy environmental variable passed in, vite will print polyfilled functions when building.

    DEBUG=vite:legacy npx vite build