Skip to content

File polyfills-legacy should not be in strict mode (Plugin legacy) #6427

@pepa-linha

Description

@pepa-linha

Describe the bug

For older browsers with IE 11 support generated file polyfills-legacy.[hash].js should not contain use strict directive, but it does.

It is required by polyfill regenerator-runtime/runtime which contains a comment: This module should not be running in strict mode, ... (https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736)

Because the built-in file contains use strict, it will result in an error.

Even if I have set

        rollupOptions: {
            output: {
                strict: false // no strict mode, ... but maybe Rollup is wrong, I am not sure
            }
        },

Reproduction

https://stackblitz.com/edit/vite-v5p4en

System Info

System:
    OS: Linux undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: Unknown - /bin/jsh
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /bin/yarn
    npm: 7.17.0 - /bin/npm
  npmPackages:
    @vitejs/plugin-legacy: ^1.6.4 => 1.6.4 
    vite: ^2.6.0 => 2.7.10

Used Package Manager

npm

Logs

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