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