Expected behavior
If you process this code with swc, the resulting code is as follow:
import a from "node-fetch";
(async ()=>{
let b = {
a: "val1",
b: "val2"
}, c = await a("https://postman-echo.com/post", {
method: "POST",
body: JSON.stringify(b),
headers: {
"c": "application/json"
}
}), d = await c.json();
console.log("RESPONSE BODY: ", d.data);
let e = {
d: "Val3"
};
console.log("Unquoted obj: ", e);
})();
As you can see, it replaced "content-type" with "c" and it also replaced the key names "key1" to a and "key2" to b , which is incorrect since the config: minify.mangle.properties.keep_quoted means that it should not mangle those properties that are quoted.
Version
"@swc/cli": "^0.1.49"
Additional context
As you could have seen from the example above, the keep_quoted feature is really important, because in some cases you don't want to minify some properties because the actual name given is needed.
Describe the bug
properties.keep_quoted
property from minify is ignored Input code SourceExpected behavior If you process this code with swc, the resulting code is as follow:
As you can see, it replaced "content-type" with "c" and it also replaced the key names
"key1"
toa
and"key2"
tob
, which is incorrect since the config:minify.mangle.properties.keep_quoted
means that it should not mangle those properties that are quoted. VersionAdditional context As you could have seen from the example above, the
keep_quoted
feature is really important, because in some cases you don't want to minify some properties because the actual name given is needed.