melonjs-deployment
Qué hace
Cubre la configuración de un proyecto melonJS nuevo, su compilación para la web y su empaquetado para plataformas móviles o de juegos. Va dirigida a desarrolladores que quieren publicar un juego melonJS.
Cuándo usarla
- ✓Cuando un desarrollador quiere iniciar un proyecto de juego melonJS nuevo a partir de la plantilla oficial.
- ✓Cuando un desarrollador quiere empaquetar un juego melonJS como app de iPhone o Android.
- ✓Cuando un desarrollador quiere publicar un juego melonJS en una plataforma de juegos.
Link de la skill
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-deployment/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Configura para mí un proyecto nuevo de juego melonJS y muéstrame cómo compilarlo para la web.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La skill usa la plantilla inicial oficial del proyecto y luego explica cómo compilar el juego y comprobar la compatibilidad con navegadores, incluida la transpilación para navegadores antiguos.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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
Preguntas frecuentes
¿Qué incluye la plantilla?
Configura un proyecto TypeScript con Vite y el plugin de depuración ya integrado.
¿Por qué mi juego muestra una página en blanco en un navegador antiguo?
El paquete del motor apunta a un estándar moderno, así que los navegadores antiguos pueden no cargarlo en absoluto.
¿Puedo añadir melonJS a un proyecto existente?
Sí. La skill indica instalar el paquete con npm.
Detalles
Descripción original del autor
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
Popularidad
- Estrellas en GitHub
- 6,4 mil
- Posición en el ranking
- #14199
- Licencia
- MIT
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
melonjs-20-migration
6,4 milAyuda a tu agente a escribir código de juegos melonJS para la versión 20 y evitar métodos desactualizados de versiones anteriores, como el arranque asíncrono obligatorio.
melonjs-3d-assets
6,4 milAyuda a tu agente a cargar modelos 3D como archivos glTF, GLB y OBJ en un juego para navegador melonJS, con opciones de escala e iluminación.
melonjs-3d
6,4 milAyuda a tu agente a crear escenas 3D o 2.5D en un juego para navegador melonJS, con cámaras, mallas, luces y profundidad, usando las reglas de ejes del motor.
melonjs-audio
6,4 milAyuda a tu agente a añadir efectos de sonido y música a un juego melonJS, incluida la configuración de audio, las pistas de fondo, el control de volumen y el sonido espacial.
Skills parecidas
diffs
394 milPermite que tu agente genere un diff real y compartible de los cambios, como enlace de visualización o archivo de imagen, en lugar de un resumen escrito a mano.
coding-agent
394 milAyuda a tu agente a pasar un trabajo de programación grande a Codex, Claude Code u OpenCode como trabajador en segundo plano, y después revisar su progreso.
gh-issues
394 milAyuda a tu agente a encontrar incidencias de GitHub, elegir cuáles trabajar y abrir pull requests con correcciones, incluido el seguimiento de los comentarios de revisión.