fix(bug): chunkFilename as function doesn't work#6672
Conversation
|
Congrats on PR privileges 🍾 @ooflorent |
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
sokra
left a comment
There was a problem hiding this comment.
There is some code in WebpackOptionsDefaulter which sets the default of chunkFilename to a function when filename is a function. Add an Error (thrown) in this case too.
|
Hmm not sure i follow, if it throws here: webpack/lib/WebpackOptionsDefaulter.js Line 88 in edbb6f6 means tests will fail for providing output.filename as a function in /tests/configCases/output/function. @sokra can you clarify? |
|
@EugeneHlushko ok you are right. We can just stop defaulting it to a function. You can skip the following lines when webpack/lib/WebpackOptionsDefaulter.js Lines 89 to 93 in edbb6f6 |
|
@EugeneHlushko Thanks for your update. I labeled the Pull Request so reviewers will review it again. @sokra Please review the new changes. |
|
So i had to wrap 1 more line into the if statement |
| if (hasChunkHash || hasName || hasId) return filename; | ||
| // Elsewise prefix "[id]." in front of the basename to make it changing | ||
| return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2"); | ||
| } |
There was a problem hiding this comment.
You need to return something in the case of filename being a function too.
Maybe just return [id].js
|
yeap looks good now |
|
Thanks |
What kind of change does this PR introduce?
Fixes #6639
Did you add tests for your changes?
no
If relevant, link to documentation update:
Summary
For technically reasons chunkFilename can't be a function. This PR disabling it on the the schema level.
Does this PR introduce a breaking change?
no
Other information