A
A
Alexander2016-10-16 18:54:57
npm
Alexander, 2016-10-16 18:54:57

How to properly run React-hot-loader?

webpack.config.js:

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

module.exports = {
    devtool: 'cheap-module-eval-source-map',
    entry: [
        'webpack-hot-middleware/client',
        'babel-polyfill',
        './src/index'
    ],
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'bundle.js',
        publicPath: '/static/'
    },
    plugins: [
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin()
    ],
    module: {
        loaders: [
            {
                loaders: ['babel-loader'],
                include: [
                    path.resolve(__dirname, "src"),
                ],
                test: /\.js$/,
                plugins: ['transform-runtime'],
            }
        ]
    }
}

I run npm start , terminal:
Module build failed: Error: React Hot Loader: The Webpack loader is now exported separately. If you use Babel, we recommend that you remove "react-hot-loader" from the "loaders" section of your Webpack configuration altogether, and instead add "react-hot-loader/babel" to the "plugins" section of your .babelrc file. If you prefer not to use Babel, replace "react-hot-loader" or "react-hot" with "react-hot-loader/webpack" in the "loaders" section of your Webpack configuration.
    at Object.warnAboutIncorrectUsage (/home/dragger/my_projects/Redux/node_modules/react-hot-loader/lib/index.js:7:11)
 @ multi main

I add .babalerc:
{
  "presets": ["es2015", "stage-0", "react"],
  "plugins": ["react-hot-loader/babel"]
}

npm start
But when I make changes in my modules, react-hot does not react to this but.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Gamega, 2016-10-16
@kentuck1213

after a long dance with a tambourine, I noticed with amazement that my licked config is doing something wrong and the application does not work in the muzzle .... after that I switched to create-react-app
if you are a ninja, this is probably not your way, but I'm happy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question