-
Notifications
You must be signed in to change notification settings - Fork 84
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
Hot loading not working. #57
Comments
Live reload does not need to be enabled. You do need to have the chrome or safari debugger running. |
I do have the Chrome debugger running. |
@jrm2k6 Based on your webpack config, you also need to set a HOT=1 ./node_modules/.bin/react-native-webpack-server start --hot |
@elliottsj thanks for getting back to me.
It seems that it is probably because of my webpack config. Any idea? |
Will do during my lunch break. And will let you know if it works! Thanks
|
@gaearon I gave it a try but it seems to be complaining about not finding 'react'. I have the following package.json/webpack config/babelrc. The error message when starting the webpack-dev-server is:
I am still fairly new to webpack so sorry if it is an easy problem to fix.
|
@jrm2k6 In your webpack config for babel-loader, make sure you ignore loaders: [{
test: /\.js$/,
include: [
path.resolve(__dirname, 'src')
],
loader: 'babel',
query: {
stage: 0,
plugins: []
}
}] |
@elliottsj I remember not ignore node_modules because it was the only way I got 3rd party modules (in my case react-native-button) to work, and playing with include didn't work either. Let me give it a quick try. |
I've had success selectively including specific 3rd-party packages like this: include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules/some-package')
], |
@elliottsj Yes, I just tried that. It builds correctly. It seems that I have to choose between including or excluding but I cannot have both. Any idea? |
There's a reason examples don't use |
@gaearon Sorry for the hassle. I might be missing something though. |
You are probably getting tripped by Packager caching: #63. Try running var os = require('os');
var fs = require('fs');
var path = require('path');
// Clear react-packager cache
var tempDir = os.tmpdir();
var cacheFiles = fs.readdirSync(tempDir).filter(function (fileName) {
return fileName.indexOf('react-packager-cache') === 0;
});
cacheFiles.forEach(function (cacheFile) {
var cacheFilePath = path.join(tempDir, cacheFile);
fs.unlinkSync(cacheFilePath);
console.log('Deleted cache: ', cacheFilePath);
});
if (!cacheFiles.length) {
console.log('No cache files found!');
} |
@jrm2k6 thanks for documenting here - i was so confused by react-native-button not working |
I followed the documentation to get react-hot-loader working in my app.
It seems that it doesn't do anything though. I keep changing one of my component and the changes are not applied until I manually refresh from the emulator.
webpack.config.js
Live Reload enabled in the emulator.
Any idea where I should look now? Sorry if it is not the right place to ask.
The text was updated successfully, but these errors were encountered: