ENAMETOOLONG when emitting HMR chunk

See original GitHub issue

Bug 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
sokracommented, Mar 14, 2021

As workaround you can manually give the worker chunk a name with /* webpackChunkName: "name" */ in the new Worker(..) call.

1reaction
alexander-akaitcommented, Mar 13, 2021

I am afraid it is not easy to fix, even more I think it is not fixable I was wrong, not hard to fix

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix spawn ENAMETOOLONG error nrwl nx workspace
This error usually appears when you have too many uncommited files (in a range more than 700 or so in my experience).
Read more >
@vue/cli-plugin-typescript | Yarn - Package Manager
fix ESDIR errors when outputDir contains dots (1682ff7), closes #2414; hash module ids in anonymous chunks, avoid ENAMETOOLONG error (69cec80), closes #2490 ...
Read more >
CHANGELOG.md · HelloBoy/vue-cli - Gitee.com
#5069 Use a single websocket connection for HMR (@lbogdan) ... hash module ids in anonymous chunks, avoid ENAMETOOLONG error (69cec80), closes #2490 ...
Read more >
mozilla-release: changeset 658209 ...
@api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); ... from loaded chunk to deferred list /******/ if(executeModules) ...
Read more >
Download Patch File
readAsArrayBuffer(chunk);buffer.set(new Uint8Array(ab),offset);return ... :131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found