Skip to content
This repository was archived by the owner on Feb 1, 2020. It is now read-only.

Conversation

@jsnanigans
Copy link
Collaborator

Proposed changes

use chunk.modules.map instead of chunk.mapModules

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • Lint and unit tests pass locally with my changes

Further comments

This should fix the issues
#11
and
FullHuman/purgecss#46

I used the webpack documentation as reference
https://webpack.js.org/contribute/plugin-patterns/#exploring-assets-chunks-modules-and-dependencies

@jsnanigans jsnanigans merged commit 30d1661 into master Jan 26, 2018
@jsnanigans jsnanigans deleted the refactor-mapModules branch January 26, 2018 22:24
@Ffloriel
Copy link
Member

I don't think using chunk.modules is the solution. The issue #1 reappears.
running the tests, I see the deprecation warning:

(node:2001) DeprecationWarning: Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.

@jsnanigans
Copy link
Collaborator Author

Maybe the issue stems from no modules being present.. I'll test this tomorrow

@jsnanigans
Copy link
Collaborator Author

@Ffloriel or how about we keep chunk.mapModules but just check if the function exists first..
something like this:

chunk.mapModules ? chunk.mapModules(mod => ...) : []

I think this would remove the error that breaks the build and avoids the deprication warning

@Ffloriel
Copy link
Member

I tried to reproduce the issue but with no success.
Ideally, it will be better to reproduce the issue to be sure it is fixed but that seems to be a good temporary solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants