Getting Started
Installation
Install @onmax/phaser-vue or @onmax/nuxt-phaser and wire the runtime without hiding Phaser.
Install the package that matches your app runtime, then configure the host layer that owns Phaser.Game.
Before you begin
- Use
@onmax/phaser-vuein a Vue 3 app when you want direct setup with no framework wrapper. - Use
@onmax/nuxt-phaserin a Nuxt app when you want the Nuxt module, auto-imports, and client-only wrapper behavior. - In Nuxt, you install both packages because the module builds on top of the shared Vue runtime.
Vue track
Use @onmax/phaser-vue when you want to install the shared runtime directly in Vue 3.
pnpm add @onmax/phaser-vue phaser
npm install @onmax/phaser-vue phaser
yarn add @onmax/phaser-vue phaser
bun add @onmax/phaser-vue phaser
src/main.ts
import { createApp } from 'vue'
import { createPhaserVue } from '@onmax/phaser-vue'
import App from './App.vue'
const app = createApp(App)
app.use(createPhaserVue({
debug: import.meta.env.DEV,
defaults: {
assetsBaseUrl: '/',
suspendWhenHidden: true,
},
}))
app.mount('#app')
Expected result: your Vue app has the runtime plugin installed and can mount PhaserGame in any component.
Nuxt track
Use @onmax/nuxt-phaser when you want the Nuxt wrapper to install the shared runtime for you.
pnpm add @onmax/nuxt-phaser @onmax/phaser-vue phaser
npm install @onmax/nuxt-phaser @onmax/phaser-vue phaser
yarn add @onmax/nuxt-phaser @onmax/phaser-vue phaser
bun add @onmax/nuxt-phaser @onmax/phaser-vue phaser
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@onmax/nuxt-phaser'],
phaser: {
clientOnly: true,
defaults: {
suspendWhenHidden: true,
assetsBaseUrl: '/',
},
},
})
Expected result: your Nuxt app registers the module once in nuxt.config.ts and keeps Phaser client-only by default.
Pick the right layer
- Use
@onmax/phaser-vuewhen you want direct Vue setup and no framework coupling. - Use
@onmax/nuxt-phaserwhen you want the Nuxt wrapper, auto-imports, andNuxtPhaserGame. - Use both packages in a Nuxt app. The Nuxt module depends on the shared Vue runtime instead of replacing it.
Next step
Continue with First game to mount one scene and verify the bridge wiring.