Describe the bug
thread '<unnamed>' panicked at 'index out of bounds: the len is 0 but the index is 0', ecmascript/minifier/src/compress/optimize/conditionals.rs:706:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
node_modules/@swc/core/index.js:59
return bindings.minifySync(src, toBuffer(opts !== null && opts !== void 0 ? opts : {}));
^
Error: index out of bounds: the len is 0 but the index is 0
at Compiler.minifySync (node_modules/@swc/core/index.js:59:25)
at Object.minifySync (node_modules/@swc/core/index.js:235:21)
at a (minifier.js:20:23)
at minifier.js:45:8
at Object.<anonymous> (minifier.js:47:3)
Input code
const swc = require("@swc/core");
const fs = require("fs");
const code = fs.readFileSync(
"node_modules/antd/dist/antd.js", // antd@4.16.9
"utf8"
);
const minified = swc.minifySync(code, {
sourceMap: false,
mangle: true,
compress: true,
});
console.log("swc:", minified.code.length);
Version
The version of @swc/core: 1.2.69