You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
upgrade to babel-loader8.x,jsx file compile wrong #856
there is something wrong happened with babel-loader 8.x and webpack 4.x.
before i submit this question,i have searched those issue.but still have no idea.
is there a bug or my usage is wrong?
the console output is:
ERROR in H:/code-program/public/widget/index.jsx
Module build failed (from H/code-program/node_modules/happypack/loader.js):
SyntaxError: H:\code-program\public\widget\index.jsx: Unexpected token (393:24)
391 | const title =
392 | index > -1 ? (
> 393 | <span>
| ^
394 | <span style={{ color: "#000", backgroundColor: "#f8cd73", padding: "2px" }}>xxxx</span>
at Parser._raise (H:\code-program\\node_modules\@babel\parser\lib\index.js:746:17)
at Parser.raiseWithData (H:\code-program\node_modules\@babel\parser\lib\index.js:739:17)
at Parser.raise (H:\code-program\node_modules\@babel\parser\lib\index.js:733:17)
at Parser.unexpected (H:\code-program\node_modules\@babel\parser\lib\index.js:8807:16)
at Parser.parseExprAtom (H:\code-program\node_modules\@babel\parser\lib\index.js:10130:20)
at Parser.parseExprSubscripts (H:\code-program\node_modules\@babel\parser\lib\index.js:9656:23)
at Parser.parseMaybeUnary (H:\code-program\node_modules\@babel\parser\lib\index.js:9636:21)
at Parser.parseExprOps (H:\code-program\node_modules\@babel\parser\lib\index.js:9506:23)
at Parser.parseMaybeConditional (H:\code-program\node_modules\@babel\parser\lib\index.js:9479:23)
at Parser.parseMaybeAssign (H:\code-program\node_modules\@babel\parser\lib\index.js:9434:21)
@ H:\code-program\public\widget\main.js
I am sorry, I also failed to reproduce this issue on REPL......
Is it possible to have a relationship with react version? my react version is 0.14.9
Have you solved the problem?
I have the similar trouble, and have no idea to solve.
the error description as follows: Module build failed: SyntaxError: ...src\tooltip.vue: Support for the experimental syntax 'jsx' isn't currently enabled (99:9): Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation. If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
Module build failed: SyntaxError: ...src\tooltip.vue: Support for the experimental syntax 'jsx' isn't currently enabled (99:9): Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation. If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
Activity
JLHwung commentedon Jul 9, 2020
Can you craft a minimal reproducing example on REPL? I can not reproduce this issue.
zhang110912 commentedon Jul 16, 2020
I am sorry, I also failed to reproduce this issue on REPL......
Is it possible to have a relationship with react version? my react version is 0.14.9
lifeilu commentedon Jul 13, 2021
Have you solved the problem?
I have the similar trouble, and have no idea to solve.
the error description as follows:
Module build failed: SyntaxError: ...src\tooltip.vue: Support for the experimental syntax 'jsx' isn't currently enabled (99:9): Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation. If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.and my dependency of babel:
and my config:
JLHwung commentedon Jul 13, 2021
@lifeilu
The error message has already provided solution:
You need to install and add
@babel/preset-reactso Babel knows it should compile JSX.lifeilu commentedon Jul 14, 2021
I have tried the provided solution, and i also add the presets of @vue/babel-preset-jsx, but it seems not work.
and my dependency of babel:
and my config:
the error description as follows:
is there something wrong with my dependency ?
existentialism commentedon Jul 14, 2021
@lifeilu what's your webpack config? is
babel-loaderbeing applied to.vuefile extensions?lifeilu commentedon Jul 15, 2021
It works for me~
I forgot to apply the
bable-loaderto.vuefile extensions.Thanks a lot~