svelthree icon indicating copy to clipboard operation
svelthree copied to clipboard

Examine / nail down `SvelteKit` / `Vite` classes suffixing (if duplicate class names) and chunks naming

Open vatro opened this issue 3 years ago • 1 comments

  • Class suffixing is a bit of a black box to me. Seems to vary depending on the process (dev / build) and SSR / CSR.
  • Also some chunk-names seem to be random.

vatro avatar Dec 07 '22 00:12 vatro

BUILD vite.config:

  • ssr: { noExternal: ['three'] }
  • optimizeDeps: { include: ['three', 'svelthree/utils', 'svelthree/stores'] }

svelte.config:

  • ssr: true

.svelte-kit/output/client/_app/immutable/chunks/OrbitControls-#.js contains almost all of the three-stuff incl.:

  • three/examples/jsm/controls/OrbitControls,
  • three/examples/jsm/helpers/RectAreaLightHelper
  • three/examples/jsm/loaders/GLTFLoader
  • three/examples/jsm/loaders/DRACOLoader
  • THREE.WebGLRenderer (function) etc.

and some (not all) svelthree-components:

  • SvelthreeInteraction
  • Mesh (not suffixed)
  • Canvas
  • Scene (not suffixed)
  • WebGLRenderer_1 (suffixed -> because THREE.WebGLRenderer isn't a class / is function?)

corresponding / same named THREE-stuff is suffixed by $1

  • Mesh$1
  • Scene$1
  • except function WebGLRenderer (instead the svelthree-component got renamed to WebGLRenderer_1)

bundled together (which is also by far the biggest chunk). It seems that the most used components + the most of the three-stuff is bundled together.

vs.

(same name, different hash) .svelte-kit/output/client/_app/immutable/chunks/OrbitControls-#.js which contains the OrbitControls-svelthree-component only, which is ok concerning naming.

vatro avatar Dec 07 '22 00:12 vatro