webpack: bug: ExtendedAPIPlugin incorrectly causes 'cannot use [chunkhash] error'
Do you want to request a feature or report a bug? Bug.
What is the current behavior?
Usage of [chunkhash]
for both output.filename
& output.chunkFilename
along with ExtendedAPIPlugin
causes incorrect compilation error.
If the current behavior is a bug, please provide the steps to reproduce.
Demo: https://github.com/hulkish/webpack-ExtendedAPIPlugin-bug
- In your webpack config, set your output to:
output: {
filename: '[name].[chunkhash].js',
chunkFilename: '[id].[chunkhash].js'
}
- Add
ExtendedAPIPlugin
:
plugins: [new ExtendedAPIPlugin()]
- Run the build & get this error:
ERROR in chunk main [entry]
[name].[chunkhash:5].js
Cannot use [chunkhash] for chunk in '[name].[chunkhash].js' (use [hash] instead)
What is the expected behavior? Should not cause this error.
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
node@8.2.0
, yarn@0.27.5
, webpack@3.3.0
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 16 (12 by maintainers)
@ICELI Sounds like you might have an actual fix, why not make pr?
bug analyze
Compare with
APIPlugin.js
andExtendedAPIPlugin.js
, we will find this line:ExtendedAPIPlugin.js#L35
so,
useChunkHash
fn always returnfalse
MainTemplate.js#L229then
noChunkHash
alwaystrue
Compilation.js#L1266
then
asset-path
plugin will throw the errorTemplatedPathPlugin.js#L63
by commenting out the following line in the ExtendedAPIPlugin.js#L35, it works fine.
hack fix:
ExtendedAPIPlugin.js
webpack.config.prod.js