diff --git a/atmosphere/src/App.jsx b/atmosphere/src/App.jsx index ed8c8534a..fc833c678 100644 --- a/atmosphere/src/App.jsx +++ b/atmosphere/src/App.jsx @@ -13,9 +13,10 @@ import * as THREE from 'three'; import { AerialPerspective, Atmosphere } from '@takram/three-atmosphere/r3f'; import { Clouds, CloudLayer } from '@takram/three-clouds/r3f'; -// --- Constants --- -const VRM_URL = '/ai.vrm'; -const VRMA_URL = '/fly.vrma'; +const BASE_URL = import.meta.env.BASE_URL; + +const VRM_URL = `${BASE_URL}ai.vrm`; +const VRMA_URL = `${BASE_URL}fly.vrma`; const EARTH_RADIUS = 6378137; // 天気変更の間隔 (ms) - 5分 diff --git a/atmosphere/vite.config.ts b/atmosphere/vite.config.ts index 9ffcc6757..88e69dd33 100644 --- a/atmosphere/vite.config.ts +++ b/atmosphere/vite.config.ts @@ -1,6 +1,11 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' +// https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + + // ★ アプリケーションのベースパスを設定 + // これにより、アセットは /pkg/atmosphere/ai.vrm のように参照されます + base: '/pkg/atmosphere/', })