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

jsx not supported (Unexpected token "<") #1

Closed
MareoRaft opened this issue Jun 6, 2019 · 6 comments
Closed

jsx not supported (Unexpected token "<") #1

MareoRaft opened this issue Jun 6, 2019 · 6 comments

Comments

@MareoRaft
Copy link

When I run npm run build, I get the error:

ERROR in ./srctest/app.js 7:4
Module parse failed: Unexpected token (7:4)
You may need an appropriate loader to handle this file type.
| const ParentWrapper = () => {
|   return (
>     <div
|       style={{
|         display: 'flex',
 @ multi (webpack)-dev-server/client?http://localhost:9000 ./srctest/app.js main[1]

This problem may not be specific to your setup in particular. I've been trying to publish my own React component and keep running into this error. It's as-if .babelrc is being ignored or similar. Your help is greatly appreciated.

@zxol
Copy link
Owner

zxol commented Jun 6, 2019

Did you mean npm run dev?

what's the output for npm run build? Same issue?

@zxol
Copy link
Owner

zxol commented Jun 6, 2019

If you do a temporary rename/delete of .babelrc do you get the same error?

@MareoRaft
Copy link
Author

Both npm run dev and npm run build give the same error.

I am get the same error regardless of the presence of babelrc. I also tried putting the babel config directly in my package.json (which is alternative way to specify your babel config), and get the same error.

Rewriting the jsx in pure JavaScript gets me passed the error and builds successfully. But this solution is not good enough, because the component I wish to ultimately publish will use a bunch of other babel features. For example, we use arrow functions within classes (e.g. render = () => {) which I have confirmed causes another error. So it seems to be some sort of babel issue...

@MareoRaft
Copy link
Author

Found a lot of info here. Unfortunately, none of these things has worked for me yet.

@zxol
Copy link
Owner

zxol commented Jun 9, 2019

I'm unable to reproduce the error on my devices. My best guess would be some kind of environment specific bug in babel loader. I've updated the dependencies for this package to their latest versions.

@MareoRaft
Copy link
Author

Ah, yeah. Thanks anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants