Missing import in Main.js (Vite)

Open Beginner friendly
#11 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
javascript, vite
Domain
build-system, cli

Research direction

Reproduce the generated project from npm create @phaserjs/game@latest and inspect its Main.js entry point. Open the local app at http://localhost:8080 and verify that the Phaser is not defined error no longer appears in the browser console.

Written by the indexing model from the issue text.

Description

I created a project template using the command:

npm create @phaserjs/game@latest

When opening http://localhost:8080 in the browser, I get the error:

Uncaught ReferenceError: Phaser is not defined at main.js:18:15

Adding this line to Main.js solves the problem:

import * as Phaser from 'phaser';

I'm using create_game version 1.2.3

Dominant language
JavaScript
Stars
72
Forks
17
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phaserjs/create-game

All issues in phaserjs/create-game

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.