用@react-three/drei包导入错误



无论我从drei包中导入什么,我都会得到相同的错误,我确信我已经安装了所有必要的包和最新版本,但是我有这个奇怪的错误。

Compiled with problems:X
ERROR in ./node_modules/@react-three/drei/core/Trail.js 104:38-54
export 'MeshLineGeometry' (imported as 'MeshLineGeometry') was not found in 'meshline' (module has no exports)

ERROR in ./node_modules/@react-three/drei/core/Trail.js 107:18-34
export 'MeshLineMaterial' (imported as 'MeshLineMaterial') was not found in 'meshline' (module has no exports)

ERROR in ./node_modules/meshline/dist/index.js 1:0-35
Module not found: Error: Can't resolve './MeshLineGeometry' in 'C:UsersanuraDesktopmysitenode_modulesmeshlinedist'
Did you mean 'MeshLineGeometry.js'?
BREAKING CHANGE: The request './MeshLineGeometry' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

降级不工作暂时解决如下:

  • 从根目录
  • node_modules/meshline/dist to lib/meshline拷贝index.js
  • 固定添加.js扩展到每行
  • 更新的构建步骤,如屏幕截图

修复lib/meshline中的index.js

构建步骤

相关内容

最新更新