-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Describe the bug
using compiler.minify produce invaild output
Input code
const obj = {}
for (let key in obj) {
obj[key] = obj[key].trim();
}
let arr = ["foo",]
arr.forEach(() => { })function func() {
(async () => {
await this.foo();
this.bar();
})()
}
func()Output code
"use strict";const a={};for(let b in a)a[b]=a[b].trim()["foo",].forEach(()=>{})NOTE: the trim()["foo",] part
"use strict";function a(){await this.foo(),this.bar()}a()NOTE: async was gone
Config
{
compress: true,
mangle: { topLevel: true },
}Expected behavior
A clear and concise description of what you expected to happen.
- should add leading semicolon for array
- should remove trailing comma of array
- should not extract IIFE
async
Version
The version of @swc/wasm-web: 1.2.73
Additional context
Add any other context about the problem here.