melonjs-deployment
Was er macht
Es behandelt das Einrichten eines neuen melonJS-Projekts, das Bauen für das Web und das Verpacken für mobile Plattformen oder Spiele-Plattformen. Es richtet sich an Entwickler, die ein melonJS-Spiel veröffentlichen wollen.
Wann du ihn nutzt
- ✓Wenn ein Entwickler ein neues melonJS-Spielprojekt aus der offiziellen Vorlage starten will.
- ✓Wenn ein Entwickler ein melonJS-Spiel als iPhone- oder Android-App verpacken will.
- ✓Wenn ein Entwickler ein melonJS-Spiel auf einer Spiele-Plattform veröffentlichen will.
Link zum Skill
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-deployment/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Richte für mich ein neues melonJS-Spielprojekt ein und zeige mir, wie ich es für das Web baue.”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Die Fähigkeit nutzt die offizielle Projektvorlage und erklärt dann, wie das Spiel gebaut wird und die Browser-Unterstützung geprüft wird, einschließlich der Übersetzung für ältere Browser.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
Starting and shipping a project
Scaffolding
Start from the template rather than assembling a build by hand:
npm create melonjs@latest my-game
The project name is required — without it the command prints its usage and exits. It downloads the melonJS TypeScript boilerplate (Vite, TypeScript and the debug plugin already wired in), which saves you the top-level-await and asset-path issues that a hand-rolled config usually hits first.
Adding melonJS to an existing project
npm install melonjs
import { Application, Sprite, loader } from "melonjs";
The package is a tree-shakeable ES module with TypeScript declarations included and no runtime dependencies.
A CDN build exists for quick experiments, but not for production:
<script type="module">
import { Application } from "https://cdn.jsdelivr.net/npm/melonjs@20/+esm";
</script>
Browser support and transpiling
The published bundle targets ES2022 and uses private class members. A browser that predates that cannot parse the file at all — it fails at load, not when a feature is used, so the symptom is a blank page with a syntax error.
To support older browsers, transpile melonJS together with your own code.
The usual trap is that build setups skip node_modules by default, leaving
melonJS untouched however low you set your target:
// vite.config.js — esbuild downlevels dependencies too
export default { build: { target: "es2020" } };
// webpack: the default `exclude: /node_modules/` would skip melonjs
{ test: /\.js$/, exclude: /node_modules\/(?!melonjs)/, use: "babel-loader" }
Two caveats worth knowing:
- Transpiling handles syntax only. Built-in methods need separate polyfills;
a bundler's
targetsetting will never add them. - Downlevelled private class members become
WeakMaplookups, and melonJS uses them in the renderer's hot paths. This is a real trade, not a free switch.
Native apps
Capacitor is the current recommendation for iOS and Android — see
@melonjs/capacitor-plugin. Cordova also works and is documented, but is the
older route.
The thing that breaks first in both is asset loading: the app is served from
file://, where fetch() cannot read local files. melonJS's loader falls back
to XHR for that scheme, so engine-loaded assets work — but any fetch() in
your game code will fail there.
Mini-game platforms
WeChat Mini Games and Facebook Instant Games are both documented in the
wiki. Note that device.platform.isWeixin detects WeChat's in-app browser,
which is a normal WebView. WeChat Mini Games are a different runtime with no
DOM, and need platform-specific adaptation rather than just detection — the one
hook the engine offers is that the renderer adopts a globalThis.canvas when
the runtime's adapter provides one, instead of creating its own.
Size
The whole engine is roughly 250 KB minzipped. Tree-shaking helps less than you might expect — the engine's subsystems reach each other, so a game importing a handful of symbols still pulls most of it. Budget for the full figure.
Practical wins are in assets, not the engine: pack sprites into atlases, prefer
one tileset over several, and use stream: true for long music tracks so they
are not decoded into memory.
Symptom → cause
| symptom | cause |
|---|---|
| blank page, syntax error in the console | browser older than the ES2022 target |
| transpiling changes nothing | build config excludes node_modules |
| assets 404 in a packaged native app | fetch() in game code — file:// needs XHR |
| a built-in method is missing after transpiling | transpiling is syntax-only; polyfills are separate |
| bundle much larger than expected | tree-shaking recovers little — subsystems are interconnected |
Related skills
melonjs— the companion packages, including the Capacitor pluginmelonjs-getting-started— the Application bootstrap the template produces
Häufige Fragen
Was enthält die Vorlage?
Sie richtet ein TypeScript-Projekt mit Vite und dem Debug-Plugin ein, die bereits verbunden sind.
Warum zeigt mein Spiel auf einem alten Browser eine leere Seite?
Das Engine-Paket zielt auf einen modernen Standard, daher können ältere Browser es gar nicht erst laden.
Kann ich melonJS zu einem bestehenden Projekt hinzufügen?
Ja. Die Fähigkeit sagt, das Paket wird mit npm installiert.
Details
Originalbeschreibung des Autors
Use this skill when packaging, shipping or scaffolding a melonJS game — starting a project with create-melonjs, building for the web, wrapping as a native app with Capacitor or Cordova, publishing to WeChat Mini Games or Facebook Instant Games, browser support and transpiling. Triggers on: create-melonjs, scaffold, new project, build, deploy, publish, Capacitor, Cordova, native app, iOS, Android, WeChat, Instant Games, browser support, transpile, ES2022, bundle size, tree-shaking.
repo: melonjs/melonJS
Beliebtheit
- GitHub-Sterne
- 6.4k
- Platz im Ranking
- #14199
- Lizenz
- MIT
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
melonjs-20-migration
6.4kHilft deinem Agenten, melonJS-Spielcode für Version 20 zu schreiben und veraltete Methoden aus älteren Versionen zu vermeiden, etwa den nun nötigen asynchronen Start.
melonjs-3d-assets
6.4kHilft deinem Agenten, 3D-Modelle wie glTF-, GLB- und OBJ-Dateien in ein melonJS-Browserspiel zu laden, mit Optionen für Maßstab und Beleuchtung.
melonjs-3d
6.4kHilft deinem Agenten, 3D- oder 2,5D-Szenen in einem melonJS-Browserspiel zu bauen, mit Kameras, Meshes, Lichtern und Tiefe, unter Beachtung der eigenen Achsenregeln der Engine.
melonjs-audio
6.4kHilft deinem Agenten, Soundeffekte und Musik in ein melonJS-Spiel einzubauen, einschließlich Audio-Einrichtung, Hintergrundmusik, Lautstärkeregelung und räumlichem Klang.
Ähnliche Skills
diffs
394kLässt deinen Agenten einen echten, teilbaren Diff seiner Änderungen als Viewer-Link oder Bilddatei erstellen, statt einer handgeschriebenen Zusammenfassung.
coding-agent
394kHilft deinem Agenten, eine größere Programmieraufgabe als Hintergrund-Worker an Codex, Claude Code oder OpenCode zu übergeben und danach den Fortschritt zu prüfen.
gh-issues
394kHilft deinem Agenten, GitHub-Issues zu finden, die zu bearbeitenden auszuwählen und Pull Requests mit Korrekturen zu öffnen, einschließlich der Nacharbeit an Review-Kommentaren.