-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Describe the bug
The minifier doesn't inline the message variable, it's still in the output (with a single use).
Input code
const ErrorResponse = (statusCode, message) => {
return Response.json({
message
}, {
status: statusCode
});
}
export const unknownError = ErrorResponse(520, "Unknown error.");or alternatively
let message;
export const unknownError = (message = "Unknown error.", Response.json({ message }, { status: 520 }));Config
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false
},
"target": "es2024",
"loose": false,
"minify": {
"compress": {
"arguments": false,
"arrows": true,
"booleans": true,
"booleans_as_integers": false,
"collapse_vars": true,
"comparisons": true,
"computed_props": true,
"conditionals": true,
"dead_code": true,
"directives": true,
"drop_console": false,
"drop_debugger": true,
"evaluate": true,
"expression": false,
"hoist_funs": false,
"hoist_props": true,
"hoist_vars": false,
"if_return": true,
"join_vars": true,
"keep_classnames": false,
"keep_fargs": true,
"keep_fnames": false,
"keep_infinity": false,
"loops": true,
"negate_iife": true,
"properties": true,
"reduce_funcs": false,
"reduce_vars": false,
"side_effects": true,
"switches": true,
"typeofs": true,
"unsafe": false,
"unsafe_arrows": false,
"unsafe_comps": false,
"unsafe_Function": false,
"unsafe_math": false,
"unsafe_symbols": false,
"unsafe_methods": false,
"unsafe_proto": false,
"unsafe_regexp": false,
"unsafe_undefined": false,
"unused": true,
"const_to_let": true,
"pristine_globals": true
},
"mangle": {
"toplevel": false,
"keep_classnames": false,
"keep_fnames": false,
"keep_private_props": false,
"ie8": false,
"safari10": false
}
}
},
"module": {
"type": "es6"
},
"minify": true,
"isModule": true
}Link to the code that reproduces this issue
SWC Info output
No response
Expected behavior
export const unknownError=Response.json({message:"Unknown error."},{status:520});Actual behavior
let message;export const unknownError=(message="Unknown error.",Response.json({message},{status:520}));Version
1.12.9
Additional context
No response