[Feature] Support plugin install pattern

Hi, the contributors of three

Thanks for writing the amazing 3D lib, it’s really good to use and give us a lot of help to develop beautiful 3D objects.

However, there is something bother me, when I am trying to import 'three/examples/js/controls/OrbitControls' as an extend method to THREE in the develop mode of ES6 modules. Such as the identifier of THREE would be undefined without handle it in Webpack, like what happened in #15583. And the OrbitControls can’t be control as a module. It makes little inconvenient and out of style in the age of Modularization Development.

I have seen the PR #14803, #15582. But I think, it’s not only about Modularization, but also something about the develop pattern of how to extend plugin to three.

Maybe The plugin pattern could be like:

import * as THREE from 'three'
import OrbitControlsPlugin from '@threejs/plugin-orbit-controls'

// Register and install a plugin.

// After register, we could use the extend method.

It will be really nice if you @mrdoob @Mugen87 could help. Thanks a lot!

Author: Fantashit

1 thought on “[Feature] Support plugin install pattern

  1. This is still a work in progress; that issue will be fixed by #15582. In the end the example modules shouldn’t reference the THREE namespace directly at all.

Comments are closed.