Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load Phaser @3.80.1 from Skypack #6838

Closed
8Observer8 opened this issue Jun 16, 2024 · 1 comment
Closed

Failed to load Phaser @3.80.1 from Skypack #6838

8Observer8 opened this issue Jun 16, 2024 · 1 comment
Assignees

Comments

@8Observer8
Copy link

8Observer8 commented Jun 16, 2024

I don't know is it an issue of Phaser or Skypack. I have created both. Skypack issue: skypackjs/skypack-cdn#371

The following link doesn't work: https://cdn.skypack.dev/[email protected]

/*
 * [Package Error] "[email protected]" could not be built. 
 *
 * No build output found.
 *
 * How to fix:
 *   - If you believe this to be an error in Skypack, file an issue here: https://github.com/skypackjs/skypack-cdn/issues
 *   - If you believe this to be an issue in the package, share this URL with the package authors to help them debug & fix.
 *   - Use https://skypack.dev/ to find a web-friendly alternative to find another package.
 */

console.warn("[Package Error] \"[email protected]\" could not be built. ");
throw new Error("[Package Error] \"[email protected]\" could not be built. ");
export default null;

For example, Pixi.js 8 and @box2D/core can be loaded from Skypack: https://plnkr.co/edit/1RizUv5yknLrb9w4

    <script type="importmap">
        {
            "imports": {
                "@box2d/core": "https://cdn.skypack.dev/@box2d/[email protected]",
                "@box2d/particles": "https://cdn.skypack.dev/@box2d/[email protected]",
                "pixi.js": "https://cdn.skypack.dev/[email protected]"
            }
        }
    </script>

    <script type="module" src="./js/index.js"></script>

index.js

import { b2CircleShape, b2World } from "@box2d/core";
import { b2ParticleGroupDef, b2ParticleSystemDef }  from "@box2d/particles";
import { Application, Graphics } from "pixi.js";

Playground for Phaser: https://plnkr.co/edit/3Vv3dfYhskSvlz52?preview

<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>The Skypack's `[email protected]` link doesn't work</title>
</head>

<body>
    <p><a href="https://github.com/phaserjs/phaser/issues/6840">Issue for Phaser</a></p>
    <p><a href="https://github.com/phaserjs/phaser/issues/6838">Issue for Skypack</a></p>

    <script type="importmap">
        {
            "imports": {
                "phaser3": "https://cdn.skypack.dev/[email protected]"
                // "phaser3": "https://8observer8.github.io/libs/[email protected]/phaser.esm.min.js"
            }
        }
    </script>

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

</html>

index.js

import { WEBGL, Game } from "phaser3";

const config = {
    type: WEBGL,
    width: 400,
    height: 300,
    scene: { preload, create, update },
    backgroundColor: "#555",
};

const game = new Game(config);

function preload() {
    console.log("preload");
}
function create() {}
function update() {}
@photonstorm
Copy link
Collaborator

There's no need to use Skypack with Phaser. We distribute Phaser ready-built and ready-bundled for browsers. There's simply no need to have a 3rd party build or minify it (which it clearly can't do correctly, probably because our entry point is our dist file, not an ES Module, which it appears it requires).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants