ENAMETOOLONG when emitting HMR chunk
See original GitHub issueBug report
What is the current behavior?
In a complex project we are applying multiple loaders - everything works as expected, however when a HMR build triggers the emitted hot-update.json
file has a too long name.
[webpack-cli] [Error: ENAMETOOLONG: name too long, open '/Users/rigor789/Code/_tmp/myVueApp/platforms/ios/myVueApp/app/_node_modules_nativescript_webpack_dist_loaders_nativescript-hot-loader_index_js_ruleSet_1_rules_8_use_0_node_modules_babel-loader_lib_index_js_clonedRuleSet-3_0_rules_0_use_0_node_modules_nativescript_webpack_dist_loaders_nativescript-worker-loader_index_js_app_app_js_10_17-67.hot-update.json'] {
errno: -63,
code: 'ENAMETOOLONG',
syscall: 'open',
path: '/Users/rigor789/Code/_tmp/myVueApp/platforms/ios/myVueApp/app/_node_modules_nativescript_webpack_dist_loaders_nativescript-hot-loader_index_js_ruleSet_1_rules_8_use_0_node_modules_babel-loader_lib_index_js_clonedRuleSet-3_0_rules_0_use_0_node_modules_nativescript_webpack_dist_loaders_nativescript-worker-loader_index_js_app_app_js_10_17-67.hot-update.json'
}
I have tried changing config.output.otUpdateMainFilename
& config.output.hotUpdateChunkFilename
however if I remove the [runtime]
placeholder - the filenames are no longer unique (and webpack warns about this correctly).
If the current behavior is a bug, please provide the steps to reproduce.
Tried to reproduce in a simple scenario but that has proven difficult - as it’s a combination of multiple plugins & loaders.
What is the expected behavior?
The HotModuleReplacementPlugin (or anywhere, if there’s a better place) should handle too long filenames, and shorten them.
Adding some logging, the runtime
is the long part that causes trouble:
https://github.com/webpack/webpack/blob/e643b85a6accde7e4c7f19c8770816e5aaf6a945/lib/HotModuleReplacementPlugin.js#L454-L463
This seems to be handled for imported chunks already: https://github.com/webpack/webpack/issues/6426
Other relevant information: webpack version: 5.25.0 Node.js version: 14.9.0 Operating System: macOS Additional tools: N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:13 (12 by maintainers)
Top GitHub Comments
As workaround you can manually give the worker chunk a name with
/* webpackChunkName: "name" */
in thenew Worker(..)
call.I am afraid it is not easy to fix, even more I think it is not fixableI was wrong, not hard to fix