You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportclassRenderer{renderStaticFrame(string1,string2){constline1Text=`${string1} and ${string2}`.toUpperCase();constline2Text='line 2 text'.toUpperCase();consttext=`${line1Text}\n${line2Text}`;returntext;}}console.log(newRenderer().renderStaticFrame('a','b'));
Output code
exportclassRenderer{renderStaticFrame(string1,string2){letline1Text=`${string1} and ${string2}`.toUpperCase();return`${line1Text}\nline 2 text`;}}console.log(newRenderer().renderStaticFrame('a','b'));
Expected behavior
Both lines are uppercase.
❯ node swc-input.js
A AND B
LINE 2 TEXT
Actual behavior
The second line is printed in lowercase, because the toUpperCase function was removed in the SWC output.
❯ node swc-output.js
A AND B
line 2 text
SWC Info output
Operating System:
Platform: darwin
Arch: arm64
Machine Type: arm64
Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000
CPU: (10 cores)
Models: Apple M1 Pro
Binaries:
Node: 20.12.2
npm: 10.5.0
Yarn: 1.22.19
pnpm: N/A
Relevant Packages:
@swc/core: N/A
@swc/helpers: 0.5.5
@swc/types: N/A
typescript: 5.4.5
next: 14.2.0
SWC Config:
output: N/A
.swcrc path: N/A
Next.js info:
output: N/A
Version
1.4.14
Additional context
From playing with the version selector in the playground, it appears this issue was introduced in version 1.3.105.
The text was updated successfully, but these errors were encountered:
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.
Describe the bug
The attached playground shows a stripped-down version of a code file that appears in my next.js project.
The SWC minifier/“compressor” removes
.toUpperCase()
from a string literal without uppercasing the string literal. The result is incorrect output.Playground link
Input code
Output code
Expected behavior
Both lines are uppercase.
Actual behavior
The second line is printed in lowercase, because the
toUpperCase
function was removed in the SWC output.SWC Info output
Version
1.4.14
Additional context
From playing with the version selector in the playground, it appears this issue was introduced in version 1.3.105.
The text was updated successfully, but these errors were encountered: