Skip to content

Instead of additionalLegacyPolyfills, a regular JS/TS user defined polyfill file #10413

@Tal500

Description

@Tal500

Description

Generalizing both #10284 and #9896.

Internally, Vite plugin-legacy do bunch of "import ..." per each element in the array of the configuration additionalLegacyPolyfills.
Why not let the user do his own imports? This way, the user has more control about external/internal polyfill setup.

Suggested solution

Let the user define some legacySetupFile in the plugin-legacy configuration, and (optionally) make the additionalLegacyPolyfills configuration deprecated (as the user can write his own import declarations in this file).

Then, the user can enjoy all modern/custom language features of JS, and write a polyfill even in TS.

Vite plugin-legacy will do a regular build to this legacy file, and will prepend all the relevant standard core-JS polyfills needed after the build.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions