Aseem Upadhyay
Aseem Upadhyay

Reputation: 4537

Build file not updating in Node.js

So I am building a react application. The application works fine in development instance. But when I try to open the final output file, the file doesn't update.

Example - I made a Hello app in React. Now, I am working in react-bootstrap. But the final output file still shows Hello.

This is my webpack.config.js file

var HTMLWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
    template: __dirname + '/app/index.html',    
    filename: 'index.html',
    inject: 'body'
});

module.exports = {

    entry: __dirname + '/app/index.js',
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
            },
            { 
                test: /\.css$/, 
                loader: "style-loader!css-loader" 
              },


        ]
    },

    output: {
        filename: 'transformed.js',
        path: __dirname+'/build'
    },
    plugins: [HTMLWebpackPluginConfig]
};

Can't understand where the error lies. Please help :)

Upvotes: 0

Views: 1759

Answers (1)

Michael Jungo
Michael Jungo

Reputation: 32972

You need to build the app again by running webpack, the bundle won't magically update itself. You might be using webpack-dev-server for development, which compiles your bundle but that is done in memory, it does not write the file to disk. If you want to have it on disk, you need to run webpack.

Upvotes: 2

Related Questions