webpack dev server hot module reloading stopped working? via /r/learnprogramming


webpack dev server hot module reloading stopped working?

I'm working on a react project and am having trouble getting the hot module reloading for webpack to work. I noticed today it stopped working, when it was working yesterday. I'm 99% sure this isn't due to some code change since I checked out a previous commit from a week ago when I knew for sure it was working and still the same thing. The only thing I can think of is that I was playing around with node versions and installed the latest version (went from 4.x.x to 8.x.x). In order to get webpack working for a successful build after this I had to go npm rebuild node-sass --force. But even now, I downgraded to 4.4.2 and still the hot module reloading is not working, so I have to go npm start every time I make a change in order to see it. Does anyone have any suggestions on what I can look into? For webpack I'm running "webpack": "^2.6.1" and for webpack dev server I'm running "webpack-dev-server": "^2.4.5". My webpack config file also looks like this, although I don't think this is it since no changes were made to this file.

const webpack = require("webpack"); const path = require("path"); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: path.resolve(__dirname, "./src/index"), output: { path: path.resolve(__dirname, "./dist"), filename: "bundle.js" }, plugins: [ new HtmlWebpackPlugin({ template: path.resolve(__dirname, "./src/index.html"), inject: "body" }) ], devServer: { inline: true, contentBase: path.resolve(__dirname, "./dist"), port: 3000, historyApiFallback: true, }, module: { loaders: [ { test: /\.js$/, exclude: /(node_modules)/, loader: path.resolve(__dirname, "./node_modules/babel-loader"), query: { presets: ["es2015", "stage-0", "react"] } }, { test: /\.css/, loader: 'style-loader!css-loader!autoprefixer-loader' }, { test: /\.scss/, loader: 'style-loader!css-loader!autoprefixer-loader!sass-loader' }, { test: /\.png$/, loader: "url-loader?limit=100000" }, { test: /\.jpg$/, loader: "file-loader" }, { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml' } ] } } 

Submitted July 16, 2017 at 07:54PM by qelsin
via reddit http://ift.tt/2tZNeGk

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s