orbit/dev/phaser-loader.mjs

13 lines
402 B
JavaScript

// Resolves the vendored Phaser shim to a headless stub for node tests.
import { registerHooks } from 'node:module';
registerHooks({
resolve(specifier, context, nextResolve) {
const r = nextResolve(specifier, context);
if (r.url.includes('/vendor/phaser.js')) {
return { ...r, url: new URL('./phaser-stub.mjs', import.meta.url).href, shortCircuit: true };
}
return r;
},
});