-
Notifications
You must be signed in to change notification settings - Fork 801
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
Webpack 2 way doesn't work #565
Comments
I ran into a similar issue awhile ago and I think it had something to do with a babel transform. I would suggest disabling transform-class-properties and seeing if that fixes it. |
I think it might be because of the order of your babel plugins. Try to move the react-hot-loader last in the array. export default {
"presets": [
["env", { "modules": false }],
"react"
],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
"react-hot-loader/babel"
],
} I have a similar setup and that works for me, although all of my babel config is inside .babelrc 😄 |
Hi, I also had a similar issue. In my case I was using the babel-preset-latest, but I think it will be the same thing for the env preset. Originally I had this in my babelrc: "presets": [
["latest", {
"modules": false
}]
] which did not work, because the options are not passed to individual "subpresets". I had to replace it with this to make it work. "presets": [
["latest", {
"es2015": {
"modules": false
}
}]
] Since I am not the only one to run into this issue, it might be worth mentioning it in the webpack2 note in the migration guide :) |
Neither export default {
"presets": [
["env", {
"es2015": {
"modules": false
}
}],
"react"
],
"plugins": [
["import", { "libraryName": "antd" }],
"transform-class-properties",
"transform-object-rest-spread",
"react-hot-loader/babel",
],
} nor export default {
"presets": [
["env", { "modules": false }],
"react"
],
"plugins": [
["import", { "libraryName": "antd" }],
"transform-class-properties",
"transform-object-rest-spread",
"react-hot-loader/babel",
],
} work here with if (module.hot) {
module.hot.accept('./App', () => {
// const NextApp = require('./App').default
// render(NextApp)
render(App)
})
} |
I can confirm that setting |
@kud you need to remove the duplication of presets settings in your .babelrc/babel.config.js, that should solve the issue for you. |
will resolve your problem ? |
worked for me
|
add option |
I've managed to work this only when fixed this three things:
|
Sounds fixed. |
https://github.com/gaearon/react-hot-loader/tree/master/docs#webpack-2
You said here I can do this:
You also specified that we have to disable module to be able to do this, so I split my babel configuration to have one for starting webpack, and one for compiling my code.
So i've got this:
But it doesn't refresh anything.
If I do:
it works.
Do you have any idea why?
I wanted to do this because I was trying to make
myFunct = () => {}
in a react class work.The text was updated successfully, but these errors were encountered: