webpack: [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
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 36 (27 by maintainers)
Putting [ext] in Output related configuration items in the document can easily mislead developers. As of 2021-06, people are still misled by this document, which is enough to show that the document needs to be revised.
@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:It could be useful if webpack would handle other module types in the future.
Another use case could be:
The bot probably shouldn’t close issues that are labelled.
Supporting
[ext]
would be awesome to avoid extra props likecssFilename: '[name].css'
or the like in the future, but this may require a whitelist of validoutput
extensions for mapping common transpiler extensions to'.html', '.css', '.js' && '.wasm'
based on their category, which is eventually inconvenient to maintain… ? On the other hand transpiler usage is slowly declining and there weren’t any new ones popping up for a while, so maybe it’s fine 😃webpack.config.js