melonjs-deployment
하는 일
새 melonJS 프로젝트 설정, 웹용 빌드, 모바일 또는 게임 플랫폼용 패키징을 다룹니다. melonJS 게임을 배포하려는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓개발자가 공식 템플릿으로 새 melonJS 게임 프로젝트를 시작하고 싶을 때.
- ✓개발자가 melonJS 게임을 iPhone이나 Android 앱으로 패키징하려 할 때.
- ✓개발자가 melonJS 게임을 게임 플랫폼에 게시하려 할 때.
스킬 링크
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-deployment/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“새 melonJS 게임 프로젝트를 만들어 주시고, 웹용으로 빌드하는 방법을 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 공식 프로젝트 스타터를 사용하고, 게임을 빌드하는 방법과 브라우저 지원을 확인하는 방법을 설명합니다. 오래된 브라우저를 위한 트랜스파일링도 포함합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
스타터에는 무엇이 들어 있나요?
Vite와 디버그 플러그인이 이미 연결된 TypeScript 프로젝트를 설정합니다.
오래된 브라우저에서 게임 페이지가 비어 있는 이유는 무엇인가요?
엔진 번들이 최신 표준을 대상으로 하므로, 오래된 브라우저는 아예 로드하지 못할 수 있습니다.
기존 프로젝트에 melonJS를 추가할 수 있나요?
네. 스킬은 npm으로 패키지를 설치하라고 말합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 6.4k
- 순위
- #14199
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
melonjs-20-migration
6.4k에이전트가 melonJS 20 버전에 맞는 게임 코드를 작성하고, 필수 비동기 시작 방식 등 이전 버전의 오래된 메서드를 피하도록 돕습니다.
melonjs-3d-assets
6.4k에이전트가 glTF, GLB, OBJ 같은 3D 모델 파일을 melonJS 브라우저 게임에 불러오고, 크기와 조명 옵션을 설정하도록 돕습니다.
melonjs-3d
6.4k에이전트가 melonJS 브라우저 게임에서 카메라, 메시, 조명, 깊이를 포함한 3D 또는 2.5D 장면을 엔진 고유의 축 규칙에 맞게 만들도록 돕습니다.
melonjs-audio
6.4k에이전트가 melonJS 게임에 효과음과 배경 음악을 추가하고, 오디오 설정, 음량 조절, 공간 음향까지 다루도록 돕습니다.