Make function static/accessible from Javascript side outside of Needle?

I got past the issue of the static function doing stuff to local scene objects with that args context example you sent, now I build a dist then try to import it with import { openHotspot, myJsInteropMethod } from "../assets/index.c995fb0b.js"; and I just get the error Uncaught SyntaxError: Cannot use import statement outside a module

by user 103054507105067008

<script type="module" should do the trick where you import your .js file

In the .html I have
<script type="module" crossorigin src="./assets/index.c995fb0b.js"></script>
In the .js I have:
import { openHotspot } from "../assets/index.c995fb0b.js";

Am I missing something really obvious here :frowning_with_open_mouth:

by user 103054507105067008

Why do you say you “build a dist and then import”? I dont understand that part

When you have build a dist it’s already done and bundled

I just have a separate website dist given to me by a client so I’m exporting a dist from Needle then copy pasting the assets and other bits across into their dist folder then changing the ref to index***.js in the index.html file from them

by user 103054507105067008

It’s so the Needle bit is running underneath a menu they already had made

by user 103054507105067008

Oh god what? Why

Because if they make any changes to that frontend html I have to keep re-adding it to my project so it’s easier to keep the 3D separate in this case so I can work on it without them merging in stuff

by user 103054507105067008

Its a very simple project too tbh

by user 103054507105067008

Just wondering why the import isn’t working

by user 103054507105067008

so is this how you import your script in your index.html? before building the dist

Yep :slightly_smiling_face:

by user 103054507105067008

I can send the project zip to you over DM if it would make more sense to see

by user 103054507105067008

Sent over DM

by user 103054507105067008