Third-Party libraries sometimes come without AMD version. This post introduces a method to wrap them using shim. I’m going to take Three.js as example. The file structure is shown below.
three.EdgeShader.js are required in
A.js, and the later of which depends on the former one.
index.html, we use shim for
deps attribute of
threeEdge denotes the dependence on
THREE.EdgeShader accessible elsewhere.
A.js, they can be accessed by calling