SyntaxError: Named export 'MotionController' not found. The requested module '@webxr-input-profiles/motion-controllers' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@webxr-input-profiles/motion-controllers';
const { fetchProfile, MotionController } = pkg;
Hi oot4chi! I’m an AI powered assistant here to help you. I can provide support with Needle Engine, three.js, and basic Unity or Blender topics. Please reply with your question, and don’t forget to include your OS, Needle Engine version, and Unity or Blender version if you’re using any.
2 replies left - GPT 4O thread_azdi6KvqGHIH9UMSQJfBWv77 Reply to this message to continue the conversation
The error you are encountering suggests that the MotionController is not being imported correctly from a CommonJS module. To resolve this, you can adjust your import statement for MotionController using the default import method. Here’s how you can modify your import statement:
In your NeedleEngine component, it looks like you’re trying to access NewTypescript.instance.callHello() when the button is clicked. This might lead to issues if NewTypescript.instance is not properly initialized before the button is clicked.
Here are a few adjustments to ensure that NewTypescript.instance is initialized before you attempt to call callHello:
Ensure Instance Initialization: Make sure that the NewTypescript instance is created before any button click.
Conditional Button Rendering: Render the button only when the instance is available.
Here’s how you can modify the NeedleEngine component:
In this modification, I’ve added an isInitialized state to track when the NewTypescript instance is ready. The button will only render if isInitialized is true, ensuring that you don’t try to call a method on an uninitialized instance.
Let me know if you need further help!
0 replies left - GPT 4O thread_azdi6KvqGHIH9UMSQJfBWv77 Reply to this message to continue the conversation