Output filename not configured Error in Webpack

前端 未结 17 1827
执笔经年
执笔经年 2021-01-07 18:08

I had installed it globally by running npm install webpack -g and I had included it in my project by running npm install webpack --save-dev.

However, on running the

相关标签:
17条回答
  • 2021-01-07 18:35

    I came across this error when there is a spelling mistake the config details.

    output: {
        path: "app/dist/assets",
        filname: "bundle.js",
        publicPath: "assets"
    },
    

    mispelled "filename". on correcting the spelling, this issue is resolved

    0 讨论(0)
  • 2021-01-07 18:37

    You MUST have a file named webpack.config.js on project root.

    0 讨论(0)
  • 2021-01-07 18:37

    Try exporting your configuration using module.exports = config where config is your configuration in a JavaScript object. In your case just do

    module.exports = {
      output: {
        filename: 'bundle.js',
        library: 'require',
        libraryTarget: 'this'
      }
    }
    

    If this does not solve your problems, refer to the issue on https://github.com/webpack/webpack/issues/2403

    0 讨论(0)
  • 2021-01-07 18:37

    If you using __dirname make sure it referenced to correct path. Default path is / which is local drive root.

    0 讨论(0)
  • 2021-01-07 18:38

    I was getting the same error and it turned out to be my webpack config file name.

    I had it as "webpack.config" instead of "webpack.config.js"

    The "Output filename not configured" error seems to come up generally when there is a typo somewhere, and I've found the file name to be a sneaky place you forget to check.

    0 讨论(0)
提交回复
热议问题