Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(order): find modules from each chunk in group#455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ryansully wants to merge1 commit intowebpack-contrib:master
base:master
Choose a base branch
Loading
fromryansully:pop-undefined

Conversation

ryansully
Copy link

fixes#257

This PR contains a:

  • bugfix
  • newfeature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

As discussed in#257, when the plugin callsmodulesByChunkGroup, it calls the chunk group'sgetModuleIndex2() function from the ChunkGroup object's_moduleIndices2 Map property. However, the error occurs because the module it's trying to find the index for doesn't exist in_moduleIndices2, causingmodulesByChunkGroup to return an empty array. The for loop that uses the array never iterates, sobestMatch is never set and is left undefined, resulting in an error when trying to call.pop() on that undefined object.

This fix checks ifgetModuleIndex2() returns no matching modules and, if so, dives into each chunk in the chunk group to find matching modules.

Breaking Changes

None.

Additional Info

While this solution dives into a chunk group's chunks to find modules that weren't in the chunk group's_moduleIndices2 property, it might indicate a bug in webpack where that property is not being fully populated as it should be. If that is the case, then this fix should no longer be necessary, but perhaps it wouldn't hurt to have an extra guard for finding chunk modules.

@jsf-clabot
Copy link

jsf-clabot commentedOct 17, 2019
edited
Loading

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecovbot commentedOct 17, 2019
edited
Loading

Codecov Report

Merging#455 (312ad6d) intomaster (50434b5) willdecrease coverage by0.82%.
The diff coverage is33.33%.

Impacted file tree graph

@@            Coverage Diff             @@##           master     #455      +/-   ##==========================================- Coverage   88.17%   87.34%   -0.83%==========================================  Files           5        5                Lines         406      411       +5       Branches       86       87       +1     ==========================================+ Hits          358      359       +1- Misses         46       50       +4  Partials        2        2
Impacted FilesCoverage Δ
src/index.js85.57% <33.33%> (-1.68%)⬇️

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update50434b5...312ad6d. Read thecomment docs.

Copy link
Member

@alexander-akaitalexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we add tests?

@ryansully
Copy link
Author

I will add tests soon so the coverage delta doesn't change.

@ryansully
Copy link
Author

I'm afraid writing a test for this will be difficult; running tests locally fails for me and I haven't been able to get them to pass.

(Thelint:prettier script also fails with an error, so I disabled it just to get Jest to run.)

@alexander-akait
Copy link
Member

Just use prettier to fix problem

@doried-a-a
Copy link

Thanks folks for being working on this. Any updates?

evilPaprika reacted with eyes emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@alexander-akaitalexander-akaitalexander-akait left review comments

@archualarchualarchual approved these changes

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

"Cannot read property 'pop' of undefined" with a common cache group
5 participants
@ryansully@jsf-clabot@alexander-akait@doried-a-a@archual

[8]ページ先頭

©2009-2025 Movatter.jp