fix: dedupe React Three Fiber in Webpack build

This commit is contained in:
134 2026-07-13 17:08:30 +08:00
parent 00cbfce56d
commit ea27d83ea9

View File

@ -5,6 +5,7 @@ import type { NextConfig } from 'next'
const configuredBasePath = process.env.NEXT_PUBLIC_PASCAL_BASE_PATH?.trim() ?? ''
const basePath = configuredBasePath ? `/${configuredBasePath.replace(/^\/+|\/+$/g, '')}` : undefined
const pascalRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
const workspaceModule = (name: string) => path.resolve(pascalRoot, 'node_modules', name)
const nextConfig: NextConfig = {
basePath,
@ -33,6 +34,16 @@ const nextConfig: NextConfig = {
'@react-three/drei': './node_modules/@react-three/drei',
},
},
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
'react$': workspaceModule('react'),
'three$': workspaceModule('three'),
'@react-three/fiber$': workspaceModule('@react-three/fiber'),
'@react-three/drei$': workspaceModule('@react-three/drei'),
}
return config
},
experimental: {
serverActions: {
bodySizeLimit: '100mb',