tl;dr - I’m confused about 'best practices in regards to ES6, npm, webpack, web hosting. Any guidance, advice or links to up to date learning are much appreciated.
My first three.js project was thrown together with a mixture of cdns - hardcopy master files and script links in my html. The code is a Frankenstein of tutorials and stack answers. It was also my first finished website using Javascript. The optimisation and ‘production readiness’ of what i’ve made would make a lot of smart people here wince in discomfort.
I’m about to start a new project and i’m really eager to do this ‘properly’ - i’m here to find out what that is and clear up some things that are confusing me.
Most of these things relate to my reading this: https://threejs.org/docs/#manual/en/introduction/Import-via-modules
If I use npm to start my project, let’s say i’m starting from scratch and have npm init inside my test folder, I ‘npm install three --save’. I think I understand that If i’m hosting on a server with a node environment, i can then npm install to ‘install’ the project and it’s dependencies on said server (is this correct?). What happens if i’m just using traditional website hosting - do i just copy the node_modules folder over along with all the usual suspects? - this makes me wonder why/if I should be using npm for smaller projects.
If i use ES6 syntax - should i also use Babel to allow it to revert back to ES5 if needed for older browsers? Should I choose to try and use ES6? I haven’t used Babel or ES6 before.
I saw a post here recently that said something like - using things like webpack or browserify were no longer recommended - it had something to do with the adoption of ES6 and removal of the three.js examples in upcoming versions of three. However webpack/browserify are the first two examples used in the three docs when it talks about npm - which also references the examples.
I apologise if this is a bit of a mess. I’m really looking for guidance - even it’s a pointer to somewhere I can find up to date information about things you think i’m getting confused about.
Also - if anyone knows of an up to date boilerplate / example project that shows best practice use of any of these things that would also be appreciated. I got this boilerplate running on my machine - but the client/server and typescript elements of it scare me.
The easiest thing for me to do now, would be download a master copy of three and repeat what I did last time - this doesn’t feel like the correct option.
Thanks to anyone who takes the time to read and/or respond to this. I really love this community and this tool. I’m hoping this uncomfortably naive set of questions will allow me to learn this all a bit quicker.