Open sawa-zen opened 3 months ago
What I did to "fix" this was update the package.json
of the @lookingglass/webxr
package with the following exports:
"exports": {
".": {
"import": "./dist/webxr.js",
"require": "./dist/webxr.umd.cjs",
"types": [
"./dist/LookingGlassConfig.d.ts",
"./dist/LookingGlassControls.d.ts",
"./dist/LookingGlassMediaController.d.ts",
"./dist/LookingGlassWebXRPolyfill.d.ts",
"./dist/LookingGlassWindow.d.ts",
"./dist/LookingGlassXRDevice.d.ts",
"./dist/LookingGlassXRWebGLLayer.d.ts"
]
}
},
You can do this easily and reproducible via the patch-package
NPM package.
Setting the following properties in your tsconfig.json
should then at least allow you to run the app:
"module": "ESNext",
"moduleResolution": "Bundler",
This will unfortunately still throw errors in some IDEs. I haven't found a way around this yet.
@PhilippCh Thank you for your advice!
I was able to resolve the issue with the following diff:
diff --git a/node_modules/@lookingglass/webxr/dist/webxr.d.ts b/node_modules/@lookingglass/webxr/dist/webxr.d.ts
new file mode 100644
index 0000000..0bee985
--- /dev/null
+++ b/node_modules/@lookingglass/webxr/dist/webxr.d.ts
@@ -0,0 +1,6 @@
+export * from "./LookingGlassControls";
+export * from "./LookingGlassMediaController";
+export * from "./LookingGlassWebXRPolyfill";
+export * from "./LookingGlassWindow";
+export * from "./LookingGlassXRDevice";
+export * from "./LookingGlassXRWebGLLayer";
\ No newline at end of file
diff --git a/node_modules/@lookingglass/webxr/package.json b/node_modules/@lookingglass/webxr/package.json
index c170f32..708874c 100644
--- a/node_modules/@lookingglass/webxr/package.json
+++ b/node_modules/@lookingglass/webxr/package.json
@@ -9,7 +9,8 @@
"exports": {
".": {
"import": "./dist/webxr.js",
- "require": "./dist/webxr.umd.cjs"
+ "require": "./dist/webxr.umd.cjs",
+ "types": "./dist/webxr.d.ts"
}
},
"version": "0.6.0",
After installing the looking-glass-webxr package via npm, I encountered an issue where the TypeScript type definition files (.d.ts) could not be found or loaded. This results in errors during development, as the necessary type definitions are missing.
I’ve attached a screenshot of the error message that occurs when attempting to use the package.
Any assistance or guidance on how to resolve this issue would be greatly appreciated.
Thank you!