Skip to content

[Bug]: The generated code may have variable scope confusion #6598

@fengluoX

Description

@fengluoX

Version

npmPackage: pnpm
rsbuild/core: 1.6.4

Details

构建前伪代码:
var speciaUnit = { ids: [] }
chart.series.forEach(function(item){
var mid = item.split('-')[2];
// ...
})

构建后代码:
var e = [];
chart.series.forEach(function(e){
var t= e.split('-')[2];
// ...
})
实际上,这在我实际的项目里,这导致了访问外层作用域变量的逻辑,构建后变成了访问内层作用域变量,从而引发了执行错误

Reproduce link

暂时无法提供复现链接

Reproduce Steps

......

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions