1

I'm getting started to Phaser 3, and I was trying to make the initial "game scenes", and I tried to use the :

import { blah } from "../asdf/blah";

ES6 syntax, and I get this error:

Uncaught Syntax Error: Unexpected token {

I'm not really sure why this happens, my browser supports that statement! ( Chrome 71 )

The parts of the code that implement "import" :

/* main.js */

import { loadScene } from "./scenes/loadScene";
import { menuScene } from "./scenes/menuScene";

let game = new Phaser.Game({
    width: 640,
    height: 360,
    scene: [
        loadScene, menuScene
    ]
});

//------------------End of main.js--------------------

/* loadScene.js */

import { CST } from "../CST";

export class loadScene extends Phaser.Scene {
    constructor() {
        super({
            key: CST.SCENES.LOAD
        });
    }

    create() {
        this.scene.start(CST.SCENES.MENU, "Hello from loadScene");
    }
}
Gama11
  • 24,825
  • 7
  • 56
  • 81
Leo1011
  • 13
  • 2

0 Answers0