Repository navigation
Truncate generated chunk name if too long - #6429
Conversation
| // long, it is truncated and a unique ID is append. The limit | ||
| // has been set to 200 to prevent `[name].[chunkhash].[ext]` | ||
| // from generating a 256+ character string. | ||
| if(name.length > 200) { |
There was a problem hiding this comment.
Better limit it to 100 chars, since windows (NTFS) limits total path length to 259 chars.
| // has been set to 200 to prevent `[name].[chunkhash].[ext]` | ||
| // from generating a 256+ character string. | ||
| if(name.length > 200) { | ||
| name = name.slice(0, 200) + "~" + (++guardID); |
There was a problem hiding this comment.
The guardID is not a good idea.
This method is called multiple times for the same combination of the chunk (for each module) and should return the same result.
In addition to that this depends on execution timing and makes builds non-deterministic.
Just return undefined in this case, which give the chunk no name, which is fine. Chunks don't need names, it's just for cooler filenames.
There was a problem hiding this comment.
Alternative: truncate it and add a hash of the full name, that's deterministic, but not sure how useful this would be.
c08995c to
48e370e
Compare
|
@ooflorent Thanks for your update. I labeled the Pull Request so reviewers will review it again. @sokra Please review the new changes. |
48e370e to
6ebdc6b
Compare
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
|
Thanks |
Similar fix of webpack/webpack#6429 [release]
What kind of change does this PR introduce?
bugfix
Did you add tests for your changes?
yes
If relevant, link to documentation update:
n/a
Summary
If a filename is longer than 255 characters an
ENAMETOOLONGerror is raised. This PR truncates the chunk name generated bySplitChunksPluginto 200 characters and happens a unique identifier after to avoid conflicts.Does this PR introduce a breaking change?
no
Other information
This is more a patch than a proper fix. Ideally webpack should never generate a long filename. However, changing the way filenames are handled is a lot more complex.
Fixes #6426