Skip to content

[Bug]: Polyfill:"Usage",but the packaged product es5 syntax has a scope problem, causing my variables to be contaminated. #4143

Closed
@PropersonCyber

Description

@PropersonCyber

Version

System:
    OS: macOS 14.5
    CPU: (8) x64 Apple M1
    Memory: 42.29 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 131.0.6778.87
    Safari: 17.5

Details

I used polyfill:'usage' to configure compatibility with my browser, but the packaged product es5 syntax has a scope problem, causing my variables to be contaminated. In my code, show_type in 3 should be used instead of show_type in 1(figure 1 is the compiled code ). How do I fix this, Or is this a bug in rsbuild?
Image
Image

Reproduce link

https://codesandbox.io/p/github/rspack-contrib/rsbuild-codesandbox-example/csb-zktgdv/draft/great-flower?file=%2Fsrc%2FApp.jsx%3A11%2C54

Reproduce Steps

npm run build

checkout index.[hash].js , search "show_type" the result will be appear!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions