Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Dec 19, 2019

This PR moves the editor to ES6 modules. I've found now a way in order to not rely on build/three.js anymore which was a blocker for the previous PR (see #16968).

@mrdoob Please review how app.js was changed. The problem is that the file is used in the editor (as part of the player) and in published projects. Hence it's not possible to import three.modules.js within the file since the path depends on the use case. THREE is now injected via new APP.Player( THREE );. It's also necessary to define THREE into the global namespace so the editor scripts are able to run.

We might want to merge the PR at the beginning of the next dev cycle since this needs some careful testing^^.

@mrdoob
Copy link
Owner

mrdoob commented Dec 19, 2019

Thanks for diving into this! 🙏

@mrdoob
Copy link
Owner

mrdoob commented Dec 19, 2019

Hmm... Similarly to when we changed the examples to use modules I think it'll make things easier to use the THREE namespace for now:

import * as THREE from '../../build/three.module.js';

Instead of:

import {
	AnimationMixer,
	CameraHelper,
	Color,
	DirectionalLightHelper,
	HemisphereLightHelper,
	Mesh,
	MeshBasicMaterial,
	ObjectLoader,
	PerspectiveCamera,
	PointLightHelper,
	Scene,
	SkeletonHelper,
	SphereBufferGeometry,
	SpotLightHelper,
	Vector3
} from '../../build/three.module.js';

@mrdoob mrdoob added this to the r113 milestone Dec 19, 2019
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Dec 20, 2019

Similarly to when we changed the examples to use modules I think it'll make things easier to use the THREE namespace for now:

Okay, done 👍

@mrdoob
Copy link
Owner

mrdoob commented Dec 20, 2019

Lets do this! 😁
I'll test it over the weekend and fix whatever I find.

@mrdoob mrdoob modified the milestones: r113, r112 Dec 20, 2019
@mrdoob mrdoob merged commit 316f6a3 into mrdoob:dev Dec 20, 2019
@mrdoob
Copy link
Owner

mrdoob commented Dec 20, 2019

Thanks!

This was referenced Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants