Why PointerLockControls is not working with my electron project

Are you including your main js file from html?

In html, we mark them as a type=“module” to allow use of “import”

It looks like however it’s being included in your case, it’s not being marked as a module.

Hi manthrax

your solution worked but i have an other error.

check this

You need to configure the way you make your imports on the project. I suggest you install vite, install three and make the imports without the use of cdn. I had this issue many times and I solved using this approuch because it’s more simple.

  1. Install Vite
  2. Install Three
  3. Make the imports inside your main.js
  4. Ensure your on .HTML is with “type=module”

Hi , iHast

Sorry , But that’s only in Web. I am talking about apps and electron

1 Like

Take a look a the official three installation docs, you have two options:

  1. Option 1: Install with NPM and a build tool.
  2. Option 2: Import from a CDN.

I think you’re using option 2, with apps and electron, you should follow Option 1, electron has its own build tools.

Oh! I see. Sorry man, my bad.

Did you try solve it using Cursor with Claude Sonnet?

Hi , Fennec

Yes , I am using the first option. But there is an error that i couldn’t solve.

Add to path / or ./ or …/

there is the code

<script type="module" src="./game.js"></script>

check paths into game.js

I checked it . It takes place in my folder and the path is correct

That’s not how the first option work, checkout this guide to see how to start a new vite project

You don’t need any <script>, just import

I know . But , I am writing my JS code in an another file . That’s why I am using it to link JS file with HTML file