acornjs / acorn-jsx

Alternative, faster React.js JSX parser
MIT License
648 stars 72 forks source link

String Literals with newline not as expected #119

Closed paranoidjk closed 3 years ago

paranoidjk commented 3 years ago

Demo JSX Code

image

AST Result

test in https://astexplorer.net/

image

Expect Result

according to https://reactjs.org/docs/jsx-in-depth.html image

RReverser commented 3 years ago

This is a parser, not a React-specific transpiler. It intentionally returns the original text in case some other implementation of JSX wants to preserve those spaces.

paranoidjk commented 3 years ago

@RReverser Thanks for your quick answer, i try it in babel repl, loooks like it works fine

image

I just wonder if the acorn jsx parser don't do this, who did this job?