-
-
Notifications
You must be signed in to change notification settings - Fork 451
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
upgrade to babel-loader8.x,jsx file compile wrong #856
Comments
Can you craft a minimal reproducing example on REPL? I can not reproduce this issue. |
I am sorry, I also failed to reproduce this issue on REPL...... |
Have you solved the problem? the error description as follows: and my dependency of babel:
and my config:
|
The error message has already provided solution:
You need to install and add
|
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 ? |
@lifeilu what's your webpack config? is |
It works for me~ |
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)
my package.json file:
"@babel/core": "^7.10.1",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-decorators": "^7.10.1",
"@babel/plugin-proposal-object-rest-spread": "^7.10.1",
"@babel/plugin-transform-arrow-functions": "^7.10.1",
"@babel/plugin-transform-react-jsx": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.1",
"@babel/preset-env": "^7.10.1",
"@babel/preset-react": "^7.10.1",
"babel-loader": "8.1.0",
"happypack": "^5.0.1",
"webpack": "4.43.0",
webpack.config.js :
this.entry = entry;
this.output = {
path: path.join(__dirname, '_build/', outputName, 'js/'),
filename: '[name].js',
};
this.module = {
rules: [
{
test: /.jsx$/,
use: 'happypack/loader?id=babel'
}]
}
this.plugins = [
new HappyPack({
id: 'babel',
loaders: ['babel-loader']
})
]
.babelrc file is :
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
],
"@babel/preset-react"
],
"plugins": [
[ "@babel/plugin-proposal-decorators", { "legacy": true } ],
[ "@babel/plugin-proposal-class-properties", { "loose": true } ],
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-react-jsx",
"@babel/plugin-transform-runtime"
]
}
my environment:
Linux and Windows 10
any suggestion will be appreciate!!!
The text was updated successfully, but these errors were encountered: