Joan
Joan

Reputation: 1395

webpack output filename config error

When I try to run npm run webpack, this shows "Error: 'output.filename' is required, either in config file or as --output-filename."

The config file is named correctly as webpack.config.js and is also in the root directory.

Below is the content in the config file:

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

module.exports - {
    entry: './app.js',
    output: { path: __dirname, filename: 'bundle.js' },

    module: {
        loaders: [
            {
                test: /.jsx?$/,
                loader: 'babel-loader',
                exclude: /node-modules/,
                query: {
                    presets: ['es2015', 'react']
                }
            }
        ]
    },
};

Would really appreciate help

Upvotes: 0

Views: 527

Answers (1)

Dale Corns
Dale Corns

Reputation: 225

You have a syntax error. module.exports - should be: module.exports = And btw, you do not need to require webpack in the configuration file.

Upvotes: 1

Related Questions