Skip to content

Next JS with Phaser: phaser3spectorjs not found #6659

Answered by Somorovd
Somorovd asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for clarifying. I switched to using the CDN in <script> tag and that seems to be working.

For future reference, compared to the procedure above:

No more npm install phaser

// app/layout.tsx

...
  return (
    <html lang="en">
      <head>
        <script
          src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.min.js"
          async
        ></script>
      </head>
      <body className={inter.className}>{children}</body>
    </html>
  );

Add phaser.d.ts to the root directory.

Also turned off reactStrictMode to prevent double loading the game in developer mode.

// next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = { reactStrictMode: false };

mo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Somorovd
Comment options

Answer selected by Somorovd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants