bug: ExtendedAPIPlugin incorrectly causes 'cannot use [chunkhash] error'
See original GitHub issueDo 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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:16 (12 by maintainers)
Top Results From Across the Web
Cannot use [chunkhash] or [contenthash] for chunk in '[name ...
Fixed my problem and still able to use chunkhash for my production filenames as well as HotModuleReplacementPlugin.
Read more >webpack/webpack - Gitter
Hi everybody ! I'm assuming some troubles on my webpack installation. Can someone could tell me what i did wrong ?
Read more >ERROR in chunk application [entry] js/[name]-[contenthash].js ...
I have always this error in red !!! ERROR in chunk application [entry] js/[name]-[contenthash].js Cannot use [chunkhash] or [contenthash] for ...
Read more >webpack @ 4.0.0-beta.3 .. 4.0.0 - Package Diff
console.error("-> When using npm: npm install webpack-cli -D"); ... + const validReasons = m.reasons.filter(reason => reason.module);.
Read more >Webpack 5 release (2020-10-10)
While this makes using modules written for Node.js easier, ... This caused much stderr output and yielded a performance problem on some ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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