#THREE local hosting PATH & HELP

38 messages · Page 1 of 1 (latest)

twin crystal
#

What's the specific error you're seeing?

slim lichen
junior vine
#

any instance of import { ... ] from 'three' you have to change to import { ... } from 'ralative/path/to/three.js'

#

The importmap doesn't do anything if you're using local files.

slim lichen
junior vine
#

Do a search in files for from 'three' and replace them all one-by-one with the relative path from that file to your three.js file.

This can be a laborious process so I really recommend you only download the extensions you really need.

junior vine
#

Example:

slim lichen
#

I did this

import * as THREE from '../APP_LIBS/build/three.module.js';
import { Water } from 'three/addons/objects/Water.js';
import { Sky } from 'three/addons/objects/Sky.js';
import { OBJLoader } from 'three/addons/loaders/OBJLoader.js';
import { MTLLoader } from 'three/addons/loaders/MTLLoader.js';

GET http://localhost/APP_LIBS/three.module.js net::ERR_ABORTED 404 (Not Found)

#

It should work right

junior vine
slim lichen
#

import * as THREE from ' path threejs '

junior vine
#

Like, that error code and screenshot makes no sense to me.

slim lichen
#

What?

#

Where do i import to the three.js

junior vine
#

Like before you use new THREE.Vector3(0, 0, 0) for example

slim lichen
#

Yeah

junior vine
#

Or you can just write import { Vector3 } from 'relative/path/to/three.js

#

But I'm really not sure what you're doing with that sock var or using HTTP requests.

slim lichen
#

I just want to import the JSM where the examples, objects ect are in build i have three file

#

Before i did this wait

#

That's what i use

#

But i want to host it local

#

OK i fixed it

junior vine
#

You also need to have Three on your HTML page. idk if you did that

slim lichen
#

I also kept the HTML:

#

yeah

junior vine
#

The script isn't a rendered object

slim lichen
#

I know

junior vine
#

It can just as easily go in the <head> section

slim lichen
#

Yeah

#

but my problem is solved thx for help it was the three path