MCPcopy
hub / github.com/vitejs/vite / recordAndRemovePolyfillBabelPlugin

Function recordAndRemovePolyfillBabelPlugin

packages/plugin-legacy/src/index.ts:1032–1046  ·  view source on GitHub ↗
(
  polyfills: Set<string>,
)

Source from the content-addressed store, hash-verified

1030}
1031
1032function recordAndRemovePolyfillBabelPlugin(
1033 polyfills: Set<string>,
1034): BabelPlugin {
1035 return ({ types: t }: { types: typeof BabelTypes }): BabelPlugin => ({
1036 name: 'vite-remove-polyfill-import',
1037 post({ path }) {
1038 path.get('body').forEach((p) => {
1039 if (t.isImportDeclaration(p.node)) {
1040 polyfills.add(p.node.source.value)
1041 p.remove()
1042 }
1043 })
1044 },
1045 })
1046}
1047
1048function replaceLegacyEnvBabelPlugin(): BabelPlugin {
1049 return ({ types: t }): BabelPlugin => ({

Callers 1

renderChunkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected