Webpack-dev-server is not detecting file changes

Viewed 215

I have a react app setup with webpack and babel. I'm trying to enable hmr from webpack which seems to work fine except that it does not recompile when I change any file under /src/ . Changing package.json does seem to be detected and forces a recompile but the changes under /src/ are still not detected even after the recompile. My webpack.config is below:

const path = require('path');
const webpack = require('webpack');

module.exports = {
    entry: {
        main: './src/index.js',
    },
    output: {
        path: path.join(__dirname, 'dist'),
        publicPath: '/',
        filename: 'bundle.js',
    },
    devServer: {
        hot: true,
        contentBase: './public/',
        publicPath: '/',
    },
    module: {
        rules: [
            {
                test: /\.(js|jsx)$/,
                include: path.join(__dirname),
                use: ['babel-loader'],
            },
        ],
    },

    plugins: [new webpack.HotModuleReplacementPlugin()],
};
0 Answers
Related