-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm #14
Comments
Yes! Do you want to write the first draft of that? 😉 |
Already took care of it, actually! https://www.npmjs.com/package/three-vrcontroller-module |
@cmloegcmluin Thanks a lot! How did you do it? Is it possible to automate? |
This is the commit that did it: cmloegcmluin@ec8c720#diff-8d6f5c826e622ae81907df0290f3fa04 Automation should be possible. The key changes are:
The rest of the changes are not important. In fact, if you were automating this, you'd probably want to simply
Good luck and let me know if you have any other questions. (By the way, a bunch of my VR Three.js stuff stopped working in Chrome this week due to a change in the WebXR API: |
Also, I noticed that the GitHub URL for my npm package was out of date, and have corrected it. I apologize if you had already gone looking for this information and I didn't make it easy on you! |
Cool! Thanks for detailed explanation. I will probably use your fork instead because I really don't get an idea of assuming THREE in global scope. I might open an PR to you repo since I found some functionality missing from the library. #25 |
Sure thing. Happy to help. I'll try to explain the whole global vs. module issue. THREE relies on the order you import files, such as with <script/> tags in your .html. You need to make sure you import the core THREE library first because that's the JavaScript file that will declare the variable THREE, and declare it scoped not to the file with a It's more popular in the community nowadays to use "dependency injection" style, where each JavaScript file states explicitly what it needs to work correctly in the form of I'm not surprised if functionality is missing - the way I did this was super-dumb - the code is just a snapshot of how it was the last time I was here. There may be some tricky way to build something that perpetually serves the latest version of THREE as modules without maintenance, but until then, PR's are no problem. |
Yes I understand the <script> tag and the whole issue with implicit dependencies on the web. Mb at the time it was design it was right decision to make but right now it just seams wrong to have implicit dependencies. I like Webpack and NPM ecosystem even though it has it's own challenges. Thanks again. |
Word. For example I recently had to bin hours of work when I couldn't resolve a circular dependency - a problem I could've pretty easily solve in the old world. PR whenever you need! |
Any interest in making this awesome tool available as an npm package?
The text was updated successfully, but these errors were encountered: