[ext] placeholder is not replaced when set in output.filename

Do you want to request a feature or report a bug?

Bug feature

What is the current behavior?

Using ‘[ext]’ placeholder in the output.filename doesn’t get replaced and instead you get a file with ‘filename.[ext]’.

If the current behavior is a bug, please provide the steps to reproduce.

Just setting the config to the following is enough:

output: {
    filename: '[name].[hash].[ext]'
}

What is the expected behavior?

‘[ext]’ should be replaced with the relevant extension.

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.

Node Version: 8.9.4
Webpack Version: 4.1.1

Author: Fantashit

1 thought on “[ext] placeholder is not replaced when set in output.filename

  1. @sokra This placeholder exists in file-loader. Would it be a good idea to support it in webpack? This would allow the devs to do the following:

    {
      entry: {
        main: "./main.js",
        styles: "./styles.css",
      },
      output: {
        filename: "[name].[contenthash].[ext]",
      }
    }

    It could be useful if webpack would handle other module types in the future.

    Another use case could be:

    {
      entry: {
        legacy: "./legacy.js",
        modern: "./modern.mjs",
        //                ^
      },
      output: {
        filename: "[name].[ext]",
      }
    }

Comments are closed.