简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM