@babel/plugin-syntax-jsx and @babel/plugin-syntax-typescript on REPL does not respect tsx contents
See original GitHub issueBug Report
- I would like to work on a fix!
Current behavior
/repl.js: Unexpected token, expected "," (4:14)
2 |
3 | export function A() {
> 4 | return <div />
| ^
5 | }
6 |
Input Code
Minimum reproduction sample on REPL.
import React from "react"
export function A() {
return <div />
}
Expected behavior Nothing happens.
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
"plugins": [
"@babel/plugin-syntax-jsx",
"@babel/plugin-syntax-typescript"
]
}
Environment
- Babel version(s): 7.10.3
- Node/npm version: N/A. Issue reproducible on REPL.
- OS: N/A
- Monorepo: no
- How you are using Babel: N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
@babel/plugin-syntax-typescript | Yarn - Package Manager
Intro. Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain...
Read more >r console does not work? - Replit
The r console here on repl it does not seem to work. Just signed on to repl.it a half hour ago to try...
Read more >My Repl does not seem to load. - Replit
The code loads in and all but the run button just keeps on showing that it is loading. I have tried connecting to...
Read more >does not work inside a function - Replit
I have a piece of code designed to choose one to three that works outside of a function but inside it says it's...
Read more >Terms of Service - Replit
If you disagree with any part of these Terms then you do not have permission to ... any users of the Service with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In Babel 7 you have to enable the
isTSX
option: https://babeljs.io/docs/en/babel-plugin-syntax-typescript#istsxWe acknowledge that
is more natural and it is now supported on Babel 8.
You can reproduce it even with
filename
set on Node.js. Please see this example.