c-frame / aframe-extras

Add-ons and helpers for A-Frame VR.
https://c-frame.github.io/aframe-extras/examples/
MIT License
972 stars 307 forks source link

Consider including browser files in NPM. #71

Closed ngokevin closed 8 years ago

ngokevin commented 8 years ago

Would like to be able to use with npmcdn. You can set a browser field in package.json to point to your browser build. Currently, pointing to the index. https://npmcdn.com/aframe-extras@2.2.0

donmccurdy commented 8 years ago

I feel like I'm missing something on npmcdn.. With the default https://npmcdn.com/aframe-extras, or if I force it to https://npmcdn.com/aframe-extras/browser.js, it doesn't roll up the dependencies.. But if I try https://npmcdn.com/aframe-extras/dist/aframe-extras.js nothing is found. How does this work?

ngokevin commented 8 years ago

Oh, sorry didn't see. It doesn't find anything because it only has access to what is deployed on npm. Because the dists aren't currently being published, it won't find anything.

donmccurdy commented 8 years ago

@ngokevin Hm, this doesn't seem feasible. The browser field is used by bundlers like Browserify too, at higher precedence than main, so if I set it to a minified build Browserify breaks. That appears to be intended behavior: https://github.com/defunctzombie/package-browser-field-spec

To do something like this, I think we'd probably need an A-Frame convention for special fields in package.json, or a convention for always naming output dist/npmcdn.min.js the same way.

ngokevin commented 8 years ago

I was able to tell Browserify to ignore it: https://github.com/ngokevin/aframe-component-boilerplate/blob/master/package.json#L9

donmccurdy commented 8 years ago

Nice, but still what if someone wants to do npm install --save aframe aframe-extras? Can't really justify the change if it means broken or nonstandard Browserify/Webpack support.