spite / THREE.MeshLine

Mesh replacement for THREE.Line
MIT License
2.14k stars 381 forks source link

Publish to NPM #28

Closed AndrewRayCode closed 7 years ago

AndrewRayCode commented 7 years ago

So package can work in modern JS builds

AndrewRayCode commented 7 years ago

Temporarily put in NPM under my own namespace https://www.npmjs.com/package/meshline-andrewray

spite commented 7 years ago

My main problem with publishing to npm is making the library work with require/commonjs/es6 modules/whatever is being used at the moment. Have you done all that work, or just published the library? And if you have, how?

AndrewRayCode commented 7 years ago

The above published version works correctly with modules (which is why I published it! 😄 ). One way to do it is set three as a peerDependnecy and require() it in the src. You can see the changes I made (note it's all on the "npm" branch):

https://github.com/AndrewRayCode/THREE.MeshLine/blob/npm/src/THREE.MeshLine.js

Basically don't rely on global variables like THREE, and definitely don't modify global variables!

After installing it's easy to require in my project:

import { MeshLine, MeshLineMaterial, } from 'meshline-andrewray';
spite commented 7 years ago

Right. But then the library can't be used with Githubissues.

  • Githubissues is a development platform for aggregating issues.