-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Bug] Parsing jsx text error #5
Labels
bug
Something isn't working
Comments
Please double check your test code and leave a repo that can reproduce the issue. |
@Test
public void testAst() throws IOException, Swc4jCoreException {
String script = "import React from 'react';\n" +
"\n" +
"function MyComponent() {\n" +
" return (\n" +
" <div>\n" +
" <p>Hello, this is JSX text!</p>\n" +
" <p>JSX allows us to write \n" +
" HTML-like syntax in JavaScript.</p>\n" +
" </div>\n" +
" );\n" +
"}\n" +
"\n" +
"export default MyComponent;";
Swc4j swc4j = new Swc4j();
Swc4jTranspileOptions options = new Swc4jTranspileOptions()
.setCaptureAst(true)
.setMediaType(Swc4jMediaType.Jsx);
Swc4jParseOutput parseOutput = swc4j.parse(script, options);
assert parseOutput != null;
} |
Please debug and check the jsx text node. |
It seems to be an SWC bug. Issue 9106 was filed. |
It's fixed in SWC. Please wait for the patch in the next couple of releases. |
The fix from SWC has been picked up. The new release will be published soon. |
It's fixed in v0.10.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is actually only one line break, but it is parsed as two line breaks
example:
The text was updated successfully, but these errors were encountered: