Goal:
To run a webserver locally and display html files - created on the PG without any webdependency.
Get the understanding, how things are connected to safely recreate these environments and advance with babylon.
Situation:
I am struggling with the .js script linkage.
Level of my Knowledge
Basically I am using BabylonJs, all the tools and I can do some scripting as well, I have some Ideas how it can work, but no deep insight of webtech, so I am following infos and instructions.
I am lacking a lot of that background web knowledge.
What I have done so far:
I have followed the getting started and installation of the nodeJS server as well the npm(s) for all the babylonjs modules.
This worked out well, server is running locally. I can display the sample as well I can display the files I download from PG.
Now I want to get independent from the web and replace the:
<!-- Babylon.js -->
<script src="https://code.jquery.com/pep/0.4.2/pep.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
<script src="https://preview.babylonjs.com/ammo.js"></script>
<script src="https://preview.babylonjs.com/cannon.js"></script>
<script src="https://preview.babylonjs.com/Oimo.js"></script>
<script src="https://preview.babylonjs.com/gltf_validator.js"></script>
<script src="https://preview.babylonjs.com/earcut.min.js"></script>
<script src="https://preview.babylonjs.com/babylon.js"></script>
<script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
<script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
<script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
<script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
<script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script>
<script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>
<script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
with the local files.
The files live inside the /node_modules folder, which is not accessible from the index.html.
Do I need to copy the needed modules into the /public/node_modules folder structure and access the scripts like that ? (that does work):
<script src="/node_modules/babylonjs/babylon.js"></script>
<script src="/node_modules/babylonjs-materials/babylonjs.materials.min.js"></script>
<script src="/node_modules/babylonjs-loaders/babylonjs.loaders.js"></script>
<script src="/node_modules/babylonjs-gui/babylon.gui.min.js"></script>
Which doesnāt seem right to me as the files would be exposed to the public.(?)
I have included:
I followed the info to include the import of the elements in the scripts.
I think I did it wrong as it doesnt work.
import * as BABYLON from 'babylonjs';
import * as GUI from 'babylonjs-gui';
import 'babylonjs-loaders';
import 'babylonjs-materials';
What I am asking for
If I am on the right path, and the things I have done so far are correct and how to proceed.
I am very happy to learn things, so thank you for your help and time.
Best. Werner