melonjs / typescript-boilerplate

A simple TypeScript x Vite based boilerplate to create games with melonJS
MIT License
5 stars 1 forks source link

When running in development mode the plugin fails to initialise #5

Open edmundg opened 3 months ago

edmundg commented 3 months ago

After running npm install then when running npm run dev an error is thrown in TypeScript when registering the debug panel. This prevents the typescript application from transpiling.

edmundg commented 3 months ago

A simple fix for this is adding a new when registering the plugin:

if (process.env.NODE_ENV === 'development') {
    import("@melonjs/debug-plugin").then((debugPlugin) => {
        // automatically register the debug panel
       plugin.register(new debugPlugin.DebugPanelPlugin, "debugPanel");
    });
}