pixijs: Bug: The requested module '/npm/@pixi/color@7.2.0-beta/+esm' does not provide an export named 'Color'

Current Behavior

Error message: The requested module ‘/npm/@pixi/color@7.2.0-beta/+esm’ does not provide an export named ‘Color’

Expected Behavior

There should be no errors.

Steps to Reproduce

index.html

<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Example</title>
</head>

<body style="caret-color: transparent;">
    <canvas id="renderCanvas" width="400" height="400"></canvas>

    <!-- Since import maps are not yet supported by all browsers, it is
        necessary to add the polyfill es-module-shims.js
        Source: https://threejs.org/docs/index.html#manual/en/introduction/Installation -->
    <script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
    <script type="importmap">
        {
            "imports": {
                "pixi-js": "https://cdn.jsdelivr.net/npm/pixi.js@7.2.0-beta/+esm",
                "matter-js": "https://cdn.jsdelivr.net/npm/matter-js@0.19.0/+esm"
            }
        }
    </script>

    <script type="module" src="js/main.js"></script>
</body>

</html>

js/main.js

// import * as PIXI from "pixi-js";
import { default as PIXI } from "pixi-js";
import { default as Matter } from "matter-js";

console.log(`Matter.js version: ${Matter.version}`);

console.log(PIXI);

Environment

Possible Solution

No response

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

This has been resolved with 7.2.0-rc: https://jsfiddle.net/bigtimebuddy/5ehL3f6q/

It seems that the cache has been flushed but 7.1.2 is still not working, because we accidentally bundled css-color-names into @pixi/utils, with invalid source map, causing https://cdn.jsdelivr.net/npm/@pixi/utils@7.1.2/+esm failed to bundle. So we can only wait for 7.2.0 now… 😢

I created a new example on Plunker. I replaced this link https://cdn.jsdelivr.net/npm/pixi.js@7.2.0-beta/+esm by this https://cdn.jsdelivr.net/npm/pixi.js@7.1.2/+esm but I have the same error:

Uncaught SyntaxError: The requested module '/npm/@pixi/color@7.2.0-beta/+esm' does not provide an export named 'Color' (at VM427 +esm:7:250)

This is caused by #8798, @pixi/ packages do not declare peerDependencies now, jsDelivr don’t know which version of package to choose, so it use the latest version (which is cached as 7.2.0-beta).

Now we can only wait for jsDelivr flusing its cache to make @7.1.2 work (don’t know how long does it take 😢). For @7.2.0-xxx we need to wait for final release of @7.2.0 to make it work.

Update: I manually fixed the dist-tags so 7.2.0-beta.2 should be on prerelease and 7.1.2 on latest