Phaser 3 with modules

You need only 1 module script in the HTML document, e.g., main.js. That’s the top-level module. That script can import any other modules it needs.

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

In the browser, module specifiers are URLs (unless you use import maps). Relative URLs must start with / or ./ or ../.

import { Game } from "";

import { gameConfig } from "./gameConfig.js";

Phaser global with modules

Phaser ESM with modules (since v3.60; experimental)