A
A
anamorph2018-11-05 15:00:12
JavaScript
anamorph, 2018-11-05 15:00:12

Why doesn't webpack-dev-server rebuild the project?

This is the webpack config

var path = require('path')

const dev = process.env.NODE_ENV !== "production"

module.exports = {
    mode: dev ? "development" : "production",
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, 'public/dist'),
        filename: 'bundle.js',
        publicPath: 'dist/'
    },
    devServer: {
        overlay: true,
        contentBase: path.join(__dirname, '/public'),
        historyApiFallback: true,
        port: 3333,
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: [
                    { loader: "babel-loader" }
                  ]
            },
            {
                test: /\.css$/,
                use: [
                  { loader: "style-loader" },
                  { loader: "css-loader" }
                ]
            }
        ]
    }
}

this is an excerpt from package.json
"scripts": {
    "dev": "webpack-dev-server",
    "start": "npm run dev"
  },

The first time at startup it builds normally. But then when you update the code, it will not change until you run npm start again

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question