Skip to content

Hot loading not working. #57

@jrm2k6

Description

@jrm2k6

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.

./node_modules/.bin/react-native-webpack-server start --hot=1
"dependencies": {
    "babel": "^5.8.23",
    "babel-loader": "^5.3.2",
    "lodash": "^3.10.1",
    "react-native": "^0.11.0-rc",
    "react-native-button": "^1.2.1",
    "react-redux": "^2.1.0",
    "redux": "^2.0.0",
    "redux-thunk": "^0.1.0",
    "superagent": "^1.3.0",
    "webpack-dev-server": "^1.10.1"
  },
  "devDependencies": {
    "react-hot-loader": "^1.3.0",
    "react-native-webpack-server": "^0.4.0-rc",
    "webpack": "^1.12.1",
    "webpack-dev-server": "^1.10.1"
  }

webpack.config.js

var fs = require('fs');
var path = require('path');
var webpack = require('webpack');

var config = {

  debug: true,

  devtool: 'source-map',

  entry: {
    'index.ios': ['./src/app.js'],
  },

  output: {
    path: path.resolve(__dirname, 'build'),
    filename: '[name].js',
  },

  module: {
    loaders: [
      {test: /\.js$/,
        loaders: ['babel?stage=0&blacklist=validation.react']},
    ],
  },

  plugins: [],

};

// Hot loader
if (process.env.HOT) {
  config.devtool = 'eval'; // Speed up incremental builds
  config.entry['index.ios'].unshift('./node_modules/react-native-webpack-server/hot/entry');
  config.entry['index.ios'].unshift('webpack/hot/only-dev-server');
  config.entry['index.ios'].unshift('webpack-dev-server/client?http://localhost:8082');
  config.output.publicPath = 'http://localhost:8082/';
  config.module.loaders[0].loaders.unshift('react-hot');
  config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
}

// Production config
if (process.env.NODE_ENV === 'production') {
  config.plugins.push(new webpack.optimize.OccurrenceOrderPlugin());
  config.plugins.push(new webpack.optimize.UglifyJsPlugin());
}

module.exports = config;

Live Reload enabled in the emulator.

Any idea where I should look now? Sorry if it is not the right place to ask.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions