S
S
SecDet2018-06-11 22:41:04
webpack
SecDet, 2018-06-11 22:41:04

Why is the webpack page not updating?

In the terminal, it says that it compiled successfully after the changes in the code. I refresh the page, nothing changes. Like it doesn't load bundle.js ? I collected it myself, not through create-react-app. You have to write yarn build after the changes , and then yarn start Here is the config

const path = require('path');

module.exports = {
    entry: "./src/index.js",
    output: {
        filename: "bundle.js",
        path : path.resolve(__dirname,"dist")
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: ['babel-loader']
            },
            {
                test: /.css$/,
                use: [
                    {
                        loader: 'style-loader'
                    },
                    {
                        loader: 'css-loader',
                    }
                ]
            }
        ]
    }
}

Here are the package scripts
"scripts": {
    "start": "webpack-dev-server --open --mode development --watch",
    "build": "webpack"
  },

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