fix: production build
This commit is contained in:
parent
d0252bc9ff
commit
ed8c07a88f
|
@ -5,7 +5,7 @@ import {useDebug} from '@/react/context/debug.js';
|
|||
import {useMainEntity} from '@/react/context/main-entity.js';
|
||||
|
||||
import Emitter from './emitter.jsx';
|
||||
import Light from './light.jsx';
|
||||
// import Light from './light.jsx';
|
||||
import Sprite from './sprite.jsx';
|
||||
|
||||
function Aabb({color, width = 0.5, x0, y0, x1, y1, ...rest}) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Group, Layer} from '@pixi/layers';
|
||||
import * as Lights from '@pixi/lights';
|
||||
|
||||
class LightLayer extends Layer {
|
||||
$$diffuseTexture;
|
||||
|
@ -42,22 +43,16 @@ class DeferredLighting {
|
|||
|
||||
export const deferredLighting = new DeferredLighting();
|
||||
|
||||
let AmbientLight, PointLight;
|
||||
|
||||
if ('undefined' !== typeof window) {
|
||||
const Lights = await import('@pixi/lights');
|
||||
AmbientLight = class AmbientLight extends Lights.AmbientLight {
|
||||
export class AmbientLight extends Lights.AmbientLight {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.parentGroup = deferredLighting.lightGroup;
|
||||
}
|
||||
}
|
||||
PointLight = class PointLight extends Lights.PointLight {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.parentGroup = deferredLighting.lightGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {AmbientLight, PointLight};
|
||||
export class PointLight extends Lights.PointLight {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.parentGroup = deferredLighting.lightGroup;
|
||||
}
|
||||
}
|
||||
|
|
8
app/server/pixi-context.js
Normal file
8
app/server/pixi-context.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import {settings} from '@pixi/core';
|
||||
|
||||
settings.ADAPTER = {
|
||||
...settings.ADAPTER,
|
||||
createCanvas: () => ({
|
||||
getContext: () => undefined,
|
||||
}),
|
||||
};
|
|
@ -44,6 +44,8 @@ let websocketBuilt = false;
|
|||
|
||||
const remixHandler = createRequestHandler({
|
||||
build: async () => {
|
||||
// patch pixi server context
|
||||
import('./app/server/pixi-context.js');
|
||||
const ssr = await (
|
||||
viteDevServer
|
||||
? viteDevServer.ssrLoadModule('virtual:remix/server-build')
|
||||
|
|
|
@ -25,6 +25,11 @@ else {
|
|||
}
|
||||
|
||||
export default defineConfig({
|
||||
esbuild: {
|
||||
supported: {
|
||||
'top-level-await': true,
|
||||
},
|
||||
},
|
||||
plugins,
|
||||
resolve: {
|
||||
alias: [
|
||||
|
@ -41,4 +46,7 @@ export default defineConfig({
|
|||
cert: readFileSync(`${cacheDirectory}/localhost.pem`),
|
||||
},
|
||||
},
|
||||
worker: {
|
||||
format: 'es',
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user