Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-excalibur-hmr

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-excalibur-hmr

Adds Scene hot module reloading to Excalibur

  • 0.0.2
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vite-plugin-excalibur-hmr

Adds scene hot reloading to Excalibur.js games.

This does not support hot reloading of actors, only scenes. When you make a change that affects a scene it will reload it without restarting the game.

It's mainly a proof-of-concept, but so there's probably issues, but it should work well enough for most cases.

Installation

npm install -d vite-plugin-excalibur-hmr

Usage

  1. Add the plugin to your vite config:
import { defineConfig } from "vite"
import hmr from "vite-plugin-excalibur-hmr"

export default defineConfig({
  plugins: [hmr()],
})
  1. Mark your engine as hot reloadable:
import hot from "vite-plugin-excalibur-hmr/hot"

const engine = new ex.Engine({
  // ...
})

if (import.meta.env.DEV) {
  hot(engine)
}

Making Scenes Hot Reloadable

In order for Scenes to be hot-reloadable, they must a default export in a file that is either under a scenes directory or ends with a .scene.ts or .scene.js extension.

Example:

// src/scenes/level1.ts or src/level1.scene.ts
import { Scene } from "excalibur"

export default class Level1 extends Scene {
  // ...
}

Whenever changes are made to the scene or any of its imported modules the scene will be hot reloaded in the engine. If that scene is currently active then it will restart.

FAQs

Package last updated on 13 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc