I am creating a new project and thought I would use ES6 modules instead of the cdn.
Imported the engine module.
import {Engine} from "/node_modules/@babylonjs/core/Engines/engine.js"
Bare metal ES6 modules don’t work because of this line of code.
import { __extends } from "tslib";
TypeError .... Relative references must start with either "/", "./", or "../".
The browser does not support this import syntax.
Are there any plans to support bare metal javascript es6 modules?
Hi, @Johan_Rabie
regarding imports what you use for bundle ?
import { Engine } from "@babylonjs/core/Engines/engine"
is normally used for referencing libs
In an ideal world I don’t want to have dependencies on bundlers during the development or prototype phase of things. Yes you can set up watchers to do compilations as you make changes but it is not ideal.
ES6 in my minds means that it is browser standards based import and export of modules without external dependencies such as bundlers or transpilers.
Now at the end of the process when you want to deploy we use rollup and terser for building the released versions of our code.
What would be really nice is if we can just use the cdn version, use it as is and at the end strip out all the dead code, but I am not sure that is even possible. Would be nice though 
To use our es6 modules you will still need to use a bundler like rollup or webpack in order to serve it in the browser.
We will soon start working on a pure esm solution that you will be able to reference in a script tag directly in the browser, but ATM it’s not possible.
1 Like