Skip to content

Multiple entrypoints on the same page causes chunks to be sourced multiple times #289

@EthanZeigler

Description

@EthanZeigler

Description
When using multiple bundles on the same page, shared dependencies are included more than once. For example, when using a "global" bundle and a specific app on the same page, shared chunks between them are sourced multiple times. This is especially problematic when global libraries like bootstrap are in those shared chunks.

Expected
When rendering a template or set of templates (extension), shared chunks are sourced only once

Actual
Shared chunks are included on the rendered page more than once, breaking libraries that rely on only having one instance.

Basic example
Given 2 bundles global and pageapp and shared chunk chunk...

{% load render_bundle from webpack_loader %}
{% render_bundle 'global' 'js' %}
{% render_bundle 'pageapp' 'js' %}

output currently is

<script type="text/javascript" src="http://localhost:8001/chunk.js"></script>
<script type="text/javascript" src="http://localhost:8001/global.js"></script>
<script type="text/javascript" src="http://localhost:8001/chunk.js"></script>
<script type="text/javascript" src="http://localhost:8001/pageapp.js"></script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions