#Converting project from cdn links to installing with npm

21 messages · Page 1 of 1 (latest)

clear mortar
#

Without the dots at all

#

‘three/examples/jsm/controls/OrbitControls’

clear mortar
#

yes, I didn't see the error on mobile, just answered the imports

#

you shouldn't import directly from node_modules

#

are you using vite?

#

nope, it doesn't

#

live server is jus a web server

#

vite is also a bundler

#

ie. it'll resolve paths for you

#

(vite - additionally to that bundling functionality - can serve as a live server)

clear mortar
#

there's essentially no difference between:

import { OrbitControls } from "../node_modules/three/examples/jsm/controls/OrbitControls.js";

and:

import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";

as long as node_modules is in the same directory as the rest of the code

#

so it's unlikely that difference is caused by this change

#

maybe you accidentally updated three to version >154 when installing vite

#

and since there were significant color changes between three 151 and 152, they might have changed the look of your scene

clear mortar
#

yup

#
clear mortar
#

nope, you can to run it only when installing new packages

#

no, if you edit the package then you have to npm install

#

I thought you meant just project files, not package.json

#

if you edit package - npm install
if you edit just the code in your project - no need to npm install

steel gust
#

Without code snippets it will be pointless. There has to be a bug somewhere. Overall, live server is something that was used in the 90s, you don’t use that any longer and it’s a terrible way to make apps (live refreshing the whole page on every change). If I was you I’d stick to weiss what you have right now and isolate the issue.