Skip to content

Commit

Permalink
fix: base path
Browse files Browse the repository at this point in the history
  • Loading branch information
barthy-koeln committed Feb 28, 2024
1 parent a5361b2 commit 9c78be4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"build-only": "yarn copy:draco && vite build",
"type-check": "vue-tsc --noEmit",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"copy:draco": "cp -r ./node_modules/three/examples/jsm/libs/draco/gltf/* ./public/draco"
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useCompressedGLTFLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function useCompressedGLTFLoader () {
const loader = new GLTFLoader()

const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath('/draco/')
dracoLoader.setDecoderPath(`${import.meta.env.BASE_URL}draco/`)
dracoLoader.preload()

loader.setDRACOLoader(dracoLoader)
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useEnvMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function useEnvMap (renderer: WebGLRenderer, url: string): Promise<
rgbeLoader
.setDataType(HalfFloatType)
.load(
url,
`${import.meta.env.BASE_URL}${url}`,
function (texture: Texture) {
const envMap = pmremGenerator.fromEquirectangular(texture).texture

Expand Down
2 changes: 1 addition & 1 deletion src/composables/useInteractiveGLTF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function useInteractiveGLTF (url: string, interactiveElementNames:
}
}

const gltf: GLTF = await gltfLoader.loadAsync(url)
const gltf: GLTF = await gltfLoader.loadAsync(`${import.meta.env.BASE_URL}${url}`)

const interactiveObjects = [] as Object3D[]
for (const objectName of interactiveElementNames) {
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
history: createWebHistory(),
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
Expand Down
17 changes: 1 addition & 16 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ export default defineConfig(({ mode }) => ({
}
},
esbuild: {
drop: mode === 'production' ? ['console', 'debugger'] : []
},
build: {
rollupOptions: {
output: {
manualChunks (id) {
if (id.includes('three/src/')) {
return 'three-core'
}

if (id.includes('node_modules')) {
return 'vendor'
}
}
}
}
// drop: mode === 'production' ? ['console', 'debugger'] : []
}
}))

0 comments on commit 9c78be4

Please sign in to comment.