I don't have enough reputation to post comments, so I have to write an answer that is not a solution to the problem, but still ...
The error you are getting is related to react-hot-loader/patch , requiring the actual react module and fixing its createElement function with the new one. See here: react-hot-loader/lib/patch.dev.js:179
The main problem is that the preact-compat module is preact-compat in webpack config react , which, apparently, does not allow setting new values, and therefore Hot Reload cannot complete everything together.
Hope this answers your question. Be that as it may - I think a hot reboot will not work in this setting.
EDIT: Found an easy solution. Change the webpack.config.js permission webpack.config.js to this to point react to your own script:
// resolve for preact webpack.resolve = { alias: { react: path.resolve(__dirname, 'react.js') // the rest goes as before } }
Now create a react.js file and put it inside (change the paths and names as you like):
var preact = require('preact-compat'); var react = {};
And done! HMR now works.
Pavel denisjuk
source share