Skip to content

Commit f044327

Browse files
committed
refactor: use vite MODE env to determine debug logs
1 parent 6f27332 commit f044327

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/App.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ let iniCamPosition: Vector3 | null = null
100100
let iniCamZPosition: number = 0
101101
const iniCamRotation: Euler = new Euler(0, 0, 0)
102102
const animTimeoutSec = 1
103-
const debugIsEnabled = false
104103
105104
// =====================
106105
// props
@@ -246,7 +245,9 @@ async function renderModel(extension: string) {
246245
}
247246
})
248247
249-
debug(model)
248+
if (import.meta.env.MODE === 'development') {
249+
debug(model)
250+
}
250251
251252
const box = new Box3()
252253
if (!model.hasOwnProperty('scene') && extension === 'stl') {
@@ -437,13 +438,11 @@ function resetModelPosition() {
437438
}
438439
}
439440
440-
function debug(output) {
441-
if (debugIsEnabled) {
442-
scene.add(new AxesHelper(10))
443-
console.log('####### DEBUG 3D MODEL #######')
444-
console.log(output)
445-
console.log('#####################')
446-
}
441+
function debug(model: object) {
442+
scene.add(new AxesHelper(10))
443+
console.log('####### DEBUG 3D MODEL #######')
444+
console.log(model)
445+
console.log('#####################')
447446
}
448447
</script>
449448

vite-env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="vite/client" />
2+
/// <reference types="vite/types/importMeta.d.ts" />

0 commit comments

Comments
 (0)