0
votes

Webpack version: 2.1.0-beta.25

Please tell us about your environment: Linux

Current behavior: If set entry name or output.fileName with prefix ‘/’,the entry file will be responded as 404.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.

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

    module.exports = { entry: { '/app': './src/index.js', },

    output: {
        path: path.resolve(__dirname, "dist"),
        filename: '[name].js'
    },
    
    devServer: {
        historyApiFallback: true,
        port: 3000,
        watchOptions: {
            aggregateTimeout: 300,
            poll: 1000
        }
    }
    

    };

OR

output: {
    path: path.resolve(__dirname, "dist"),
    filename: '\[name].js'
},
1
I believe that output.filename must be a file name only (no path).Tien Do

1 Answers

0
votes

As @Tien Do commented, output.filename is only to hold the name of the file to be published to the path given.

From Webpack:

output.filename Specifies the name of each output file on disk. You must not specify an absolute path here! The output.path option determines the location on disk the files are written to, filename is used solely for naming the individual files.