Update Vite configuration to enhance dependency optimization and build settings

- Added 'three' and its GLTFLoader to the optimizeDeps include array for improved module resolution.
- Introduced custom Rollup options to prevent externalization of the 'three' library during the build process.
- Configured CommonJS options to include 'three' and node_modules for better compatibility with dependencies.
This commit is contained in:
Torsten Schulz (local)
2026-01-22 12:24:57 +01:00
parent 78d43e6859
commit 3d5342b314

View File

@@ -33,15 +33,16 @@ export default defineConfig(({ mode }) => {
}) })
}, },
optimizeDeps: { optimizeDeps: {
esbuildOptions: { include: ['three', 'three/examples/jsm/loaders/GLTFLoader.js'],
plugins: [ esbuildOptions: {
NodeGlobalsPolyfillPlugin({ plugins: [
buffer: true NodeGlobalsPolyfillPlugin({
}), buffer: true
NodeModulesPolyfillPlugin() }),
] NodeModulesPolyfillPlugin()
} ]
}, }
},
resolve: { resolve: {
alias: { alias: {
'@': path.resolve(__dirname, './src'), '@': path.resolve(__dirname, './src'),
@@ -50,5 +51,16 @@ export default defineConfig(({ mode }) => {
assert: 'assert', assert: 'assert',
} }
}, },
build: {
rollupOptions: {
output: {
// Stelle sicher, dass three nicht externalisiert wird
manualChunks: undefined
}
},
commonjsOptions: {
include: [/three/, /node_modules/]
}
},
}; };
}); });