import legacy from '@vitejs/plugin-legacy';

export default legacy({
  // 尝试兼容低版本浏览器（不包括ie11）
  targets: ['chrome 52'],
  additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
  renderLegacyChunks: true,
  polyfills: [
    'es.symbol',
    'es.array.filter',
    'es.promise',
    'es.promise.finally',
    'es/map',
    'es/set',
    'es.array.for-each',
    'es.object.define-properties',
    'es.object.define-property',
    'es.object.get-own-property-descriptor',
    'es.object.get-own-property-descriptors',
    'es.object.keys',
    'es.object.to-string',
    'web.dom-collections.for-each',
    'esnext.global-this',
    'esnext.string.match-all',
  ],
  // modernPolyfills: ['es.string.replace-all']
});
