Is it necessary to use local web servers for development?

I execute my program most of the time with the Microsoft Edge Browser, because it needs a server to run my selfcoded webapps on chrome or firefox…
Error in Chrome:
Access to script at ‘file:/// jsm/loaders/PLYLoader.js’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
This is one of 40 errors. on Apache server it runs successfully.

That is the reason i test my code with edge because i dont need a server to run the app.
Now i included loading draco files with dracoloader and got this error in edge:
SCRIPT438: Object doesn’t support property or method ‘finally’
I tried executing the dracoloader three.js example and same error appears, so i noticed after searching in the web, that it is a problem with Edge.
How do other people work with three.js? Just running a server every time?

Hi @anon81599084 I use a trick to emulate server to get passed CORS issue. If you have python you can try this in a .bat file to start your project. With this, you can run your three.js project in chrome, or changing the .exe name with any other browser. Run this file where your index.html is.

start chrome.exe http://localhost:7000
python -m http.server 7000

Also must comment for some reason, edge is very very slow compared to other browsers when I try running my threejs project.

It’s definitely recommended to use a local server. There is actually a whole guide about this topic:

https://threejs.org/docs/index.html#manual/en/introduction/How-to-run-things-locally

1 Like