Answer the question
In order to leave comments, you need to log in
React and hmr, why doesn't Webpack rebuild the project?
Hello!
I want to start using webpack to build a React project. First, my config:
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:4567',
'webpack/hot/only-dev-server',
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot', 'babel'],
include: [path.join(__dirname, 'src')]
}]
}
};
src
--app
----actions
----components
----constants
----reducers
----app.js
----config.js
--index.js
Answer the question
In order to leave comments, you need to log in
The config is a bit old. I dug out my config with a similar version, I don’t see any special differences. Unless the module include specifies the directory at once, and not an array element.
{ test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: ['react-hot','babel?stage=0&optional=runtime&plugins=typecheck'],
include: path.join(__dirname, 'src/js')
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question