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.jsandExtendedAPIPlugin.js, we will find this line:ExtendedAPIPlugin.js#L35
so,
useChunkHashfn always returnfalseMainTemplate.js#L229then
noChunkHashalwaystrueCompilation.js#L1266
then
asset-pathplugin will throw the errorTemplatedPathPlugin.js#L63
by commenting out the following line in the ExtendedAPIPlugin.js#L35, it works fine.
hack fix:
ExtendedAPIPlugin.jswebpack.config.prod.js