whitlockjc / json-refs

Various utilities for JSON Pointers (http://tools.ietf.org/html/rfc6901) and JSON References (http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm for browser

brettz9 opened this issue · comments

With the world seemingly moving away from Bower, might your npm version bundle the browser file (without requiring consumers to browserify)?

People are moving away from Bower?

Per https://bower.io/ itself, "While Bower is maintained, we recommend yarn and webpack for new front-end projects!" (see also bower/bower#2298 ).

For the time being, It still has a steady stream of downloads, but regardless, I've seen a number of projects drop bower support or speak of just using npm, and the main reason is I'd like not to have to migrate a whole project toward supporting bower when I can otherwise get by with npm (whose migration to yarn is supposed to be easy and can apparently remain compatible).

I'd think that just adding browser directory to files in package.json would be of widest benefit, even if some Node users might not need those files.

Let me give it some thought, I'm not disagreeing I just want to weigh my options.

Any take on a decision?

As a separate but potentially related issue--it'd be great to have ES6 module support, both an ES Module export for environments directly consuming such modules (with the file pointed to by module in package.json), and a Rolled-up version (main or browser in package.json). Browserify doesn't do this, but Rollup is quite friendly to use... (I'm too preoccupied myself to put a PR for this, but would be nice if you end up revisiting distribution of files...)

We are currently using the Babel transform for Browserify. That should make it where you can use ES6 modules without issue, right?

Babel can handle individual files, but browserify doesn't work with it in wrapping it all together; see browserify/browserify#1186 . Maybe with babelify though as per this comment: browserify/browserify#1761 (comment)

Whatever the solution, I hope the ES6 modules distribution would be workable within the browser.

Great to see the recent improvements...Any decision here on allowing inclusion of browser?

I need to do a little research on this. A lot of the plumbing for browser stuff is deprecated or no longer the best way to do things so I need to figure out what's best. I'm all ears.

Not sure what you're looking for specifically, but on the bundling side, I'd really recommend Rollup for cleanness and ease of use and its ability to export ES6 modules as well as CommonJS/UMD/IIFE...

Oh, I've no expectation. I'm just saying that bower and browserify were the thing to use years ago but aren't now, and I've no idea what their replacements are (or should be). It seems you have an opinion and I just need to research it a little. That's all.

Gotcha... This is popular, and I recommend it too: https://rollupjs.org/guide/en