Hello there,
I was very happy to see that in r105 there are now modules that can be easily imported. Sadly this results for me in having three.js twice in my final bundle (at least that’s what I think).
My current pipeline is
Writing stuff in TypeScript
Gulp with tsify, babelify and then browserify to get the code running again in the browser.
In order to bundle the file with browserify I need to jump back to es5 syntax which might create my problem. My new bundle is now almost twice the size and experiences the same problem as described here: https://github.com/mrdoob/three.js/issues/6362
Example import:
import { Scene, Group, PerspectiveCamera, CubeTexture, Object3D, AmbientLight } from 'three';
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
gulp pipeline:
return browserify({
debug: true
})
.add("./src/main.ts")
.plugin(tsify, { noImplicitAny: true })
.transform(
babelify,
{
only: [
"./node_modules/three/build/three.module.js",
"./node_modules/three/examples/jsm/*"
],
global: true,
sourceType: "unambiguous",
presets: ["@babel/preset-env"],
plugins: ['@babel/plugin-transform-modules-commonjs']
}
)
.bundle()
When not doing the import of jsm files the problem does not occur. I’m wondering if there is a way to use the jsm files with browserify, or if there is another way to import them in a clean way.