Skip to content
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

minified flag incorrectly transforms SingleEscapeCharacters #4767

Closed
HyeonuPark opened this issue Oct 24, 2016 · 2 comments · Fixed by #9501
Closed

minified flag incorrectly transforms SingleEscapeCharacters #4767

HyeonuPark opened this issue Oct 24, 2016 · 2 comments · Fixed by #9501
Labels
Has PR i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: generator

Comments

@HyeonuPark
Copy link

It prints additional backslash

Input Code

const babel = require('babel-core')
console.log(babel.transform('"foo\\n\\t\\r"', {minified: true}).code)

Expected Behavior

"foo\n\t\r"

Current Behavior

"foo\\n\\t\\r"

Your Environment

software version
Babel 6.17.0
node 6.1.0
npm 3.10.8
Operating System Linux Mint 17.3
@DrewML
Copy link
Member

DrewML commented Nov 2, 2016

I think this may have regressed here in the getPossibleRaw method. Commenting out the check for this.format.minified that was added in that commit fixes the bug.

@DrewML DrewML added the i: bug label Nov 2, 2016
@DrewML DrewML changed the title minified flag not working with string escape character minified flag incorrectly transforms SingleEscapeCharacters Nov 2, 2016
@aaronang
Copy link
Member

I have done some investigation and it seems that the current library that we are using does not have any support for not escaping special characters, e.g. \n, \r, \t, etc.

Have a look here: mathiasbynens/jsesc#20.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 17, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Has PR i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: generator
Projects
None yet
5 participants