-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swc removes the backslash "\" when target is "es5" even if "minify" option is not set #8871
Comments
related links, it has already been realized with But it doesn't seem to work in swc-playground now🤔. I guess it only works in |
It's really expected that the contents of the original string will be preserved. The developer knows what they are writing and why they are writing it, and does not want the content to be removed. #8863 even if they are equivalent。 |
It should work in playground, and I investigated: InvestigationThe problem is that we drop |
Lowering priority as the behavior of swc is not wrong. If it causes a problem for real world app, please provide some details about the usecase. |
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 backslash was deleted when I was using swc, causing a syntax error in the js I inserted into the script tag of html.
Babel or TypeScript doesn't seem to have this behavior, which caused string to be modified before minimizing.
typescript-playground
babel-playground
Additionally, terser automatically avoids this error, and I am unaware whether it is a good behavior and whether it is worth for swc to follow.
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.4.15-nightly-20240416.4&code=H4sIAAAAAAAAA0vOzysuUahQsFVQstFXUtBWUCpOLsosKLFT4koGS1WCpWL00YSrQMIx%2BjH6CgoKMTFKXFypFQX5RSUK1QoVOkA9OlUKtQB9gcrVWwAAAA%3D%3D&config=H4sIAAAAAAAAA21Qyw6DMAy78xUo5123w%2F5hH1GVgDr1pSRMQ4h%2FXwu0KtJuje3aideu7%2BHNGp79mp5piIoYqc4J4cWL%2BiYEZInImkwUuBVWOFOjsow7tB0M2BAYEyM04wk54824tNY6uEjIXByqq1N%2BsvjXWEh5HgO51ohQaWmADM1ejMseoK1iNroundgBP2hDdOjlkpJyrmmKJswSQL5DdxLgwjDv%2B52t5WYO0aMRlXvrbWD4VX7mYrrtB6t7kgaBAQAA
SWC Info output
No response
Expected behavior
Same as babel, backslash will not be deleted.
Actual behavior
Version
1.4.15-nightly-20240416.4
Additional context
No response
The text was updated successfully, but these errors were encountered: