Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
grischaerbe authored Jun 19, 2024
2 parents fd26175 + 4469e24 commit 3b91ec2
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 64 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-needles-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@threlte/extras": patch
---

imported classes as types not values in Gizmo and MeshRefractionMaterial components
15 changes: 0 additions & 15 deletions apps/docs/src/content/learn/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@ can be used with `npx`, the resulting Threlte components however require `@threl

<ManualInstallGuide client:load />

### Configuration

#### Adapt `vite.config.js`

If you are using Threlte with SvelteKit, adapt your Vite configuration to prevent `three` from being externalized for SSR by vites externalization step

```js {3-5}+ title=vite.config.js
const config = {
//
ssr: {
noExternal: ['three']
}
}
```

<Tip type="tip">
[See this comment](https://github.com/threlte/threlte/issues/8#issuecomment-1024085864) for tips
on how to reduce bundle size when working with bundlers like vite and three.js.
Expand Down
3 changes: 0 additions & 3 deletions packages/core/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ const config = {
alias: {
threlte: resolve('./src/lib')
}
},
ssr: {
noExternal: ['three']
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { defineConfig } from 'vitest/config';

export default defineConfig({
plugins: [sveltekit()],
ssr: {
noExternal: ['three']
},
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [sveltekit()],
ssr: {
noExternal: ['three']
}
plugins: [sveltekit()]
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { defineConfig } from 'vitest/config'

export default defineConfig({
plugins: [sveltekit()],
ssr: {
noExternal: ['three']
},
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [sveltekit()],
ssr: {
noExternal: ['three']
}
plugins: [sveltekit()]
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import mkcert from 'vite-plugin-mkcert';

export default defineConfig({
plugins: [mkcert(), sveltekit()],
ssr: {
noExternal: ['three']
},
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ import { defineConfig } from 'vite';
import mkcert from 'vite-plugin-mkcert';

export default defineConfig({
plugins: [mkcert(), sveltekit()],
ssr: {
noExternal: ['three']
}
plugins: [mkcert(), sveltekit()]
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import mkcert from 'vite-plugin-mkcert'

export default defineConfig({
plugins: [mkcert(), sveltekit()],
ssr: {
noExternal: ['three']
},
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ import { defineConfig } from 'vite'
import mkcert from 'vite-plugin-mkcert'

export default defineConfig({
plugins: [mkcert(), sveltekit()],
ssr: {
noExternal: ['three']
}
plugins: [mkcert(), sveltekit()]
})
2 changes: 1 addition & 1 deletion packages/extras/src/lib/components/Gizmo/Gizmo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Quaternion,
Raycaster,
Scene,
Sprite,
type Sprite,
Vector2,
Vector3,
Vector4,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { T, useParent, useTask, useThrelte } from '@threlte/core'
import { Color, CubeTexture, Matrix4, Mesh, ShaderMaterial, Texture, Vector2 } from 'three'
import { Color, type CubeTexture, Matrix4, Mesh, ShaderMaterial, Texture, Vector2 } from 'three'
import { onMount } from 'svelte'
import { MeshBVH, MeshBVHUniformStruct, SAH } from 'three-mesh-bvh'
import type {
Expand Down
5 changes: 1 addition & 4 deletions packages/extras/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { threeMinifier } from '@yushijinhun/three-minifier-rollup'
* @type {import('vite').UserConfig}
*/
const config = {
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }],
ssr: {
noExternal: ['three']
}
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }]
}

export default config
5 changes: 1 addition & 4 deletions packages/flex/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { threeMinifier } from '@yushijinhun/three-minifier-rollup'
* @type {import('vite').UserConfig}
*/
const config = {
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }],
ssr: {
noExternal: ['three']
}
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }]
}

export default config
5 changes: 1 addition & 4 deletions packages/rapier/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { sveltekit } from '@sveltejs/kit/vite'
* @type {import('vite').UserConfig}
*/
const config = {
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }],
ssr: {
noExternal: ['three']
}
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }]
}

export default config
5 changes: 1 addition & 4 deletions packages/theatre/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { sveltekit } from '@sveltejs/kit/vite'
* @type {import('vite').UserConfig}
*/
const config = {
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }],
ssr: {
noExternal: ['three']
}
plugins: [sveltekit(), { ...threeMinifier(), enforce: 'pre' }]
}

export default config

0 comments on commit 3b91ec2

Please sign in to comment.