Skip to content

Entry points can be incorrectly omitted from origins in assets file #8

@tomkelsey

Description

@tomkelsey

Expected Behavior

For the entries in "entrypoints" in the asset manifest to also be keys in "origins"

Current Behavior

I have a situation where the above isn't happening.

I think what is happening is that:

  • I use react-loadable for a small component.
  • I think webpack is seeing enough overlap between my entrypoint and the small component to combine them into one chunk.
  • Then when getChunkOrigin runs, it finds the import statement for my small component (which is also the entrypoint chunk) and adds an entry into "origins" under /Components/SmallComponent
  • origins.size is not 0 and therefore names[0] (the name of the entrypoint) is never added as an origin key.
  • This then causes the entrypoint bundles not to be loaded

Possible Solution

Potentially adding something like this to the end of getChunkOrigin:

    if (this.entrypoints.has(names[0])) {
      origins.add(names[0]);
    }

I'm working with a very rudimentary understanding of how things work so I don't know if this is the right approach and, if so, whether we also need to check the other entries in names or against the id too.

Metadata

Metadata

Assignees

Labels

investigationThis issue needs an investigation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions