反应三个光纤drei typescript构建错误



我正在尝试构建一个使用r3f和drei作为依赖项的typescript项目。这些模块在storybook中工作正常,没有错误。

当使用下面的脚本构建项目时,我得到这个:

Found 73 errors in 20 files.
Errors  Files
1  node_modules/@react-three/drei/core/Text.d.ts:49
1  node_modules/@react-three/fiber/dist/declarations/src/core/index.d.ts:12
1  node_modules/@react-three/fiber/dist/declarations/src/core/loop.d.ts:11
1  node_modules/@react-three/fiber/dist/declarations/src/core/renderer.d.ts:3
2  node_modules/@react-three/fiber/dist/declarations/src/core/store.d.ts:31
1  node_modules/three-stdlib/cameras/CinematicCamera.d.ts:10
1  node_modules/three-stdlib/csm/CSM.d.ts:61
1  node_modules/three-stdlib/exporters/GLTFExporter.d.ts:41
1  node_modules/three-stdlib/geometries/ParametricGeometries.d.ts:3
4  node_modules/three-stdlib/index.d.ts:82
1  node_modules/three-stdlib/nodes/accessors/CameraNode.d.ts:6
4  node_modules/three-stdlib/nodes/materials/MeshStandardNodeMaterial.d.ts:1
1  node_modules/three-stdlib/nodes/materials/NodeMaterial.d.ts:6
47  node_modules/three-stdlib/nodes/Nodes.d.ts:8
1  node_modules/three-stdlib/nodes/procedural/CheckerNode.d.ts:4
1  node_modules/three-stdlib/nodes/utils/TimerNode.d.ts:2
1  node_modules/three-stdlib/webxr/ARButton.d.ts:1
1  node_modules/three-stdlib/webxr/OculusHandModel.d.ts:1
1  node_modules/three-stdlib/webxr/VRButton.d.ts:1
1  node_modules/three-stdlib/webxr/XREstimatedLight.d.ts:1

我搜索了一下,但我完全不知道这些问题是从哪里来的,也不知道如何修复它们。

我package.json

{
"main": "dist/index.js",
"scripts": {
"start": "npm run storybook",
"test": "echo "Error: no test specified" && exit 1",
"storybook": "start-storybook -s ./public,./dist -p 6006",
"build-storybook": "build-storybook -s public",
"prepublishOnly": "npm run build",
"build": "rm -rf ./dist && tsc -d --jsx react --outDir ./dist src/index.ts"
},
"devDependencies": {
"@babel/core": "^7.18.6",
"@storybook/addon-actions": "^6.5.9",
"@storybook/addon-essentials": "^6.5.9",
"@storybook/addon-interactions": "^6.5.9",
"@storybook/addon-links": "^6.5.9",
"@storybook/builder-webpack4": "^6.5.9",
"@storybook/manager-webpack4": "^6.5.9",
"@storybook/react": "^6.5.9",
"@storybook/testing-library": "^0.0.13",
"@types/three": "^0.141.0",
"babel-loader": "^8.2.5",
"typescript": "^4.7.4"
},
"dependencies": {
"@react-three/drei": "^9.17.1",
"@react-three/fiber": "^8.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"three": "^0.142.0"
}
}

tsconfig.json

{
"compilerOptions": {
"target": "es5",
"outDir": "dist",
"lib": ["dom", "dom.iterable", "esnext"],
"declaration": true,
"declarationDir": "lib",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["src"],
"exclude": ["node_modules", "lib"]
}

完整构建输出:

> rm -rf ./dist && tsc -d --jsx react --outDir ./dist src/index.ts
node_modules/@react-three/drei/core/Text.d.ts:49:24 - error TS2304: Cannot find name 'TextMeshImpl'.
49     onSync?: ((troika: TextMeshImpl) => void) | undefined;
~~~~~~~~~~~~
node_modules/@react-three/fiber/dist/declarations/src/core/index.d.ts:12:187 - error TS2694: Namespace '"/Users/user/project/node_modules/@types/three/index"' has no exported member 'XRFrame'.
12 declare const invalidate: (state?: RootState | undefined, frames?: number) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
                                                                                                                       ~~~~~~~
node_modules/@react-three/fiber/dist/declarations/src/core/loop.d.ts:11:107 - error TS2694: Namespace '"/Users/user/project/node_modules/@types/three/index"' has no exported member 'XRFrame'.
11     advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
                                       ~~~~~~~
node_modules/@react-three/fiber/dist/declarations/src/core/renderer.d.ts:3:8 - error TS1259: Module '"/Users/user/project/node_modules/@types/react-reconciler/index"' can only be default-imported using the 'esModuleInterop' flag
3 import Reconciler from 'react-reconciler';
~~~~~~~~~~
node_modules/@types/react-reconciler/index.d.ts:1135:1
1135 export = ReactReconciler;
~~~~~~~~~~~~~~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
node_modules/@react-three/fiber/dist/declarations/src/core/store.d.ts:31:86 - error TS2694: Namespace '"/Users/user/project/node_modules/@types/three/index"' has no exported member 'XRFrame'.
31 export declare type RenderCallback = (state: RootState, delta: number, frame?: THREE.XRFrame) => void;
                  ~~~~~~~
node_modules/@react-three/fiber/dist/declarations/src/core/store.d.ts:94:225 - error TS2694: Namespace '"/Users/user/project/node_modules/@types/three/index"' has no exported member 'XRFrame'.
94 declare const createStore: (invalidate: (state?: RootState | undefined, frames?: number | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean | undefined, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void) => UseBoundStore<RootState>;
                                                                                                                                                             ~~~~~~~
node_modules/three-stdlib/cameras/CinematicCamera.d.ts:10:10 - error TS2305: Module '"./../shaders/BokehShader2"' has no exported member 'BokehShaderUniforms'.
10 import { BokehShaderUniforms } from './../shaders/BokehShader2';
~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/csm/CSM.d.ts:61:25 - error TS2307: Cannot find module './CSMFrustum.js' or its corresponding type declarations.
61 import CSMFrustrum from './CSMFrustum.js';
~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/exporters/GLTFExporter.d.ts:41:75 - error TS2304: Cannot find name 'OffscreenCanvas'.
41 declare type ImageRepresentation = HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap;
       ~~~~~~~~~~~~~~~
node_modules/three-stdlib/geometries/ParametricGeometries.d.ts:3:36 - error TS2307: Cannot find module './ParametricGeometry' or its corresponding type declarations.
3 import { ParametricGeometry } from './ParametricGeometry';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/index.d.ts:82:1 - error TS2308: Module './modifiers/CurveModifier' has already exported a member named 'Flow'. Consider explicitly re-exporting to resolve the ambiguity.
82 export * from './nodes/Nodes';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/index.d.ts:104:1 - error TS2308: Module './objects/Reflector' has already exported a member named 'Reflector'. Consider explicitly re-exporting to resolve the ambiguity.
104 export * from './objects/ReflectorForSSRPass';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/index.d.ts:104:1 - error TS2308: Module './objects/Reflector' has already exported a member named 'ReflectorOptions'. Consider explicitly re-exporting to resolve the ambiguity.
104 export * from './objects/ReflectorForSSRPass';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/index.d.ts:106:1 - error TS2308: Module './objects/Water' has already exported a member named 'Water'. Consider explicitly re-exporting to resolve the ambiguity.
106 export * from './objects/Water2';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/accessors/CameraNode.d.ts:6:27 - error TS2307: Cannot find module '../inputs/FloatNode' or its corresponding type declarations.
6 import { FloatNode } from '../inputs/FloatNode';
~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/materials/MeshStandardNodeMaterial.d.ts:1:23 - error TS2307: Cannot find module '../../../../src/math/Color' or its corresponding type declarations.
1 import { Color } from '../../../../src/math/Color';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/materials/MeshStandardNodeMaterial.d.ts:2:25 - error TS2307: Cannot find module '../../../../src/textures/Texture' or its corresponding type declarations.
2 import { Texture } from '../../../../src/textures/Texture';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/materials/MeshStandardNodeMaterial.d.ts:3:29 - error TS2307: Cannot find module '../../../../src/textures/CubeTexture' or its corresponding type declarations.
3 import { CubeTexture } from '../../../../src/textures/CubeTexture';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/materials/MeshStandardNodeMaterial.d.ts:4:25 - error TS2307: Cannot find module '../../../../src/math/Vector2' or its corresponding type declarations.
4 import { Vector2 } from '../../../../src/math/Vector2';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/materials/NodeMaterial.d.ts:6:25 - error TS2307: Cannot find module './nodes/RawNode' or its corresponding type declarations.
6 import { RawNode } from './nodes/RawNode';
~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:8:15 - error TS2307: Cannot find module './core/StructNode' or its corresponding type declarations.
8 export * from './core/StructNode';
~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:13:15 - error TS2307: Cannot find module './core/NodeLib' or its corresponding type declarations.
13 export * from './core/NodeLib';
~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:21:15 - error TS2307: Cannot find module './inputs/BoolNode' or its corresponding type declarations.
21 export * from './inputs/BoolNode';
~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:22:15 - error TS2307: Cannot find module './inputs/IntNode' or its corresponding type declarations.
22 export * from './inputs/IntNode';
~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:23:15 - error TS2307: Cannot find module './inputs/FloatNode' or its corresponding type declarations.
23 export * from './inputs/FloatNode';
~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:24:15 - error TS2307: Cannot find module './inputs/Vector2Node' or its corresponding type declarations.
24 export * from './inputs/Vector2Node';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:25:15 - error TS2307: Cannot find module './inputs/Vector3Node' or its corresponding type declarations.
25 export * from './inputs/Vector3Node';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:26:15 - error TS2307: Cannot find module './inputs/Vector4Node' or its corresponding type declarations.
26 export * from './inputs/Vector4Node';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:27:15 - error TS2307: Cannot find module './inputs/ColorNode' or its corresponding type declarations.
27 export * from './inputs/ColorNode';
~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:28:15 - error TS2307: Cannot find module './inputs/Matrix3Node' or its corresponding type declarations.
28 export * from './inputs/Matrix3Node';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:29:15 - error TS2307: Cannot find module './inputs/Matrix4Node' or its corresponding type declarations.
29 export * from './inputs/Matrix4Node';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:30:15 - error TS2307: Cannot find module './inputs/TextureNode' or its corresponding type declarations.
30 export * from './inputs/TextureNode';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:31:15 - error TS2307: Cannot find module './inputs/CubeTextureNode' or its corresponding type declarations.
31 export * from './inputs/CubeTextureNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:32:15 - error TS2307: Cannot find module './inputs/ScreenNode' or its corresponding type declarations.
32 export * from './inputs/ScreenNode';
~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:33:15 - error TS2307: Cannot find module './inputs/ReflectorNode' or its corresponding type declarations.
33 export * from './inputs/ReflectorNode';
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:34:15 - error TS2307: Cannot find module './inputs/PropertyNode' or its corresponding type declarations.
34 export * from './inputs/PropertyNode';
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:35:15 - error TS2307: Cannot find module './inputs/RTTNode' or its corresponding type declarations.
35 export * from './inputs/RTTNode';
~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:40:15 - error TS2307: Cannot find module './accessors/ColorsNode' or its corresponding type declarations.
40 export * from './accessors/ColorsNode';
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:44:15 - error TS2307: Cannot find module './accessors/LightNode' or its corresponding type declarations.
44 export * from './accessors/LightNode';
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:46:15 - error TS2307: Cannot find module './accessors/ScreenUVNode' or its corresponding type declarations.
46 export * from './accessors/ScreenUVNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:47:15 - error TS2307: Cannot find module './accessors/ResolutionNode' or its corresponding type declarations.
47 export * from './accessors/ResolutionNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:57:15 - error TS2307: Cannot find module './procedural/NoiseNode' or its corresponding type declarations.
57 export * from './procedural/NoiseNode';
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:62:15 - error TS2307: Cannot find module './misc/TextureCubeUVNode' or its corresponding type declarations.
62 export * from './misc/TextureCubeUVNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:63:15 - error TS2307: Cannot find module './misc/TextureCubeNode' or its corresponding type declarations.
63 export * from './misc/TextureCubeNode';
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:64:15 - error TS2307: Cannot find module './misc/NormalMapNode' or its corresponding type declarations.
64 export * from './misc/NormalMapNode';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:65:15 - error TS2307: Cannot find module './misc/BumpMapNode' or its corresponding type declarations.
65 export * from './misc/BumpMapNode';
~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:69:15 - error TS2307: Cannot find module './utils/BypassNode' or its corresponding type declarations.
69 export * from './utils/BypassNode';
~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:71:15 - error TS2307: Cannot find module './utils/SwitchNode' or its corresponding type declarations.
71 export * from './utils/SwitchNode';
~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:73:15 - error TS2307: Cannot find module './utils/VelocityNode' or its corresponding type declarations.
73 export * from './utils/VelocityNode';
~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:74:15 - error TS2307: Cannot find module './utils/UVTransformNode' or its corresponding type declarations.
74 export * from './utils/UVTransformNode';
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:75:15 - error TS2307: Cannot find module './utils/MaxMIPLevelNode' or its corresponding type declarations.
75 export * from './utils/MaxMIPLevelNode';
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:76:15 - error TS2307: Cannot find module './utils/SpecularMIPLevelNode' or its corresponding type declarations.
76 export * from './utils/SpecularMIPLevelNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:77:15 - error TS2307: Cannot find module './utils/ColorSpaceNode' or its corresponding type declarations.
77 export * from './utils/ColorSpaceNode';
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:81:15 - error TS2307: Cannot find module './effects/BlurNode' or its corresponding type declarations.
81 export * from './effects/BlurNode';
~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:82:15 - error TS2307: Cannot find module './effects/ColorAdjustmentNode' or its corresponding type declarations.
82 export * from './effects/ColorAdjustmentNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:83:15 - error TS2307: Cannot find module './effects/LuminanceNode' or its corresponding type declarations.
83 export * from './effects/LuminanceNode';
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:87:15 - error TS2307: Cannot find module './materials/nodes/RawNode' or its corresponding type declarations.
87 export * from './materials/nodes/RawNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:88:15 - error TS2307: Cannot find module './materials/nodes/BasicNode' or its corresponding type declarations.
88 export * from './materials/nodes/BasicNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:89:15 - error TS2307: Cannot find module './materials/nodes/SpriteNode' or its corresponding type declarations.
89 export * from './materials/nodes/SpriteNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:90:15 - error TS2307: Cannot find module './materials/nodes/PhongNode' or its corresponding type declarations.
90 export * from './materials/nodes/PhongNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:91:15 - error TS2307: Cannot find module './materials/nodes/StandardNode' or its corresponding type declarations.
91 export * from './materials/nodes/StandardNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:92:15 - error TS2307: Cannot find module './materials/nodes/MeshStandardNode' or its corresponding type declarations.
92 export * from './materials/nodes/MeshStandardNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:97:15 - error TS2307: Cannot find module './materials/BasicNodeMaterial' or its corresponding type declarations.
97 export * from './materials/BasicNodeMaterial';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:98:15 - error TS2307: Cannot find module './materials/SpriteNodeMaterial' or its corresponding type declarations.
98 export * from './materials/SpriteNodeMaterial';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:99:15 - error TS2307: Cannot find module './materials/PhongNodeMaterial' or its corresponding type declarations.
99 export * from './materials/PhongNodeMaterial';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:100:15 - error TS2307: Cannot find module './materials/StandardNodeMaterial' or its corresponding type declarations.
100 export * from './materials/StandardNodeMaterial';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/Nodes.d.ts:105:15 - error TS2307: Cannot find module './postprocessing/NodePostProcessing' or its corresponding type declarations.
105 export * from './postprocessing/NodePostProcessing';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/procedural/CheckerNode.d.ts:4:33 - error TS2307: Cannot find module '../utils/UVTransformNode' or its corresponding type declarations.
4 import { UVTransformNode } from '../utils/UVTransformNode';
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/nodes/utils/TimerNode.d.ts:2:27 - error TS2307: Cannot find module '../inputs/FloatNode' or its corresponding type declarations.
2 import { FloatNode } from '../inputs/FloatNode';
~~~~~~~~~~~~~~~~~~~~~
node_modules/three-stdlib/webxr/ARButton.d.ts:1:25 - error TS2305: Module '"three"' has no exported member 'XRSessionInit'.
1 import { WebGLRenderer, XRSessionInit } from 'three';
~~~~~~~~~~~~~
node_modules/three-stdlib/webxr/OculusHandModel.d.ts:1:35 - error TS2305: Module '"three"' has no exported member 'XRInputSource'.
1 import { Object3D, Mesh, Texture, XRInputSource, Vector3 } from 'three';
~~~~~~~~~~~~~
node_modules/three-stdlib/webxr/VRButton.d.ts:1:25 - error TS2305: Module '"three"' has no exported member 'XRSessionInit'.
1 import { WebGLRenderer, XRSessionInit } from 'three';
~~~~~~~~~~~~~
node_modules/three-stdlib/webxr/XREstimatedLight.d.ts:1:47 - error TS2305: Module '"three"' has no exported member 'XRFrame'.
1 import { DirectionalLight, Group, LightProbe, XRFrame, WebGLRenderer, Texture } from 'three';
~~~~~~~

Found 73 errors in 20 files.
Errors  Files
1  node_modules/@react-three/drei/core/Text.d.ts:49
1  node_modules/@react-three/fiber/dist/declarations/src/core/index.d.ts:12
1  node_modules/@react-three/fiber/dist/declarations/src/core/loop.d.ts:11
1  node_modules/@react-three/fiber/dist/declarations/src/core/renderer.d.ts:3
2  node_modules/@react-three/fiber/dist/declarations/src/core/store.d.ts:31
1  node_modules/three-stdlib/cameras/CinematicCamera.d.ts:10
1  node_modules/three-stdlib/csm/CSM.d.ts:61
1  node_modules/three-stdlib/exporters/GLTFExporter.d.ts:41
1  node_modules/three-stdlib/geometries/ParametricGeometries.d.ts:3
4  node_modules/three-stdlib/index.d.ts:82
1  node_modules/three-stdlib/nodes/accessors/CameraNode.d.ts:6
4  node_modules/three-stdlib/nodes/materials/MeshStandardNodeMaterial.d.ts:1
1  node_modules/three-stdlib/nodes/materials/NodeMaterial.d.ts:6
47  node_modules/three-stdlib/nodes/Nodes.d.ts:8
1  node_modules/three-stdlib/nodes/procedural/CheckerNode.d.ts:4
1  node_modules/three-stdlib/nodes/utils/TimerNode.d.ts:2
1  node_modules/three-stdlib/webxr/ARButton.d.ts:1
1  node_modules/three-stdlib/webxr/OculusHandModel.d.ts:1
1  node_modules/three-stdlib/webxr/VRButton.d.ts:1
1  node_modules/three-stdlib/webxr/XREstimatedLight.d.ts:1

构建指令不正确。我必须重新配置整个tsconfig。并将构建脚本更改为:

"build": "rm -rf ./lib && tsc -p ./tsconfig.json"

最新更新