Setting up a standalone Babylon project without npm

Scratching my head… I am just trying to get started and looking at something super basic like Getting Started With Babylon.js - DZone Web Dev

I do not want to use npm to install anything. I just want a single html file (ideally one that I can load locally off my disk) that will reference one or more scripts, perhaps from cdnjs, which I can then add JS code to and create a scene and so on. I can’t find anything that shows me how to do this. The above link is the closest I found and tried to follow, and this is what I get:

This doesn’t work, I assume because the Babylon code is missing dependencies?

It is because you try to use the canvas to early. Move your script tag with the code after the canvas in the body to be sure it is there and if you want to keep it in the header, you should ensure it runs only onDomContentLoaded.

1 Like

@sebavan Thanks very much… that was a bad oversight on my part and the fact that it got pretty far without complaining didn’t help.
As per original topic, is the single file that I included actually a fully bundled Babylon release without any external requirements or additional modules? For example three.js has certain additional modules in three.js/examples/jsm at dev · mrdoob/three.js · GitHub… does Babylon have something similar?

The one you use here is the full bundle minus the file loaders, serializers and materials library. Once you are close to release, you could move to our es6 version so save space.

Hello sebavan by saying - you could move to our es6 version so save space. You mean in order to use those modules you need to use npm? is there a way to include parts of babylon as simple js files

Not without relying on our npm package I am afraid.

While it is not possible to include only some parts of Babylon.js without npm it is possible to choose whether you need any of additional scripts (loaders, postprocess, serializer etc).
See the list below:

        <!-- Babylon.js -->
        <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/earcut.min.js"></script>
        <script src="https://preview.babylonjs.com/babylon.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>
        <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
1 Like

will there be any future update that it will allow not rely on node, just simple js, thanks?

The files from @labris do not require node here, I am not sure to understand ?