swc-project / swc

Rust-based platform for the Web
https://swc.rs
Apache License 2.0
31.22k stars 1.23k forks source link

Minified output contains `var 0` #1983

Closed mischnic closed 3 years ago

mischnic commented 3 years ago

Describe the bug

The minified output contains var 0={isMounted: (but a number cannot be a variable name).

Input code

const swc = require("@swc/core");
const fs = require("fs");

const code = fs.readFileSync(
  "node_modules/react/cjs/react.development.js", // react@17.0.2
  "utf8"
);

const minified = swc.minifySync(code, {
  sourceMap: false,
  mangle: true,
  compress: true
});
fs.writeFileSync("dist/react.swc.js", minified.code);

Version The version of @swc/core: 1.2.69

swc-bot commented 2 years ago

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.