Skip to content

Modules executing in reverse post-order #6261

@guybedford

Description

@guybedford

Module execution of ES modules is based on post-order execution up the graph (with circular deduping).

The Edge behaviour is incorrectly implementing a reverse post-order execution.

The simple example of this is the following:

<script>order=[]</script>
<script type="module">
import '/a.js';
import '/b.js';
console.log(order);
</script>

where a.js contains order.push('a') and b.js similarly.

where edge will execute b and then a, instead of a and then b!

The fix should be simple (one loop can just be reversed somewhere), but this is a really important bug to fix as many projects will write code like the following:

import 'polyfill';
import 'stuff-that-needs-polyfill';

and without these guaranatees those code paths break down.

I would highly recommend marking this as an urgent priority.

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