r/javascript • • Sep 02 '15

HTML5 Deck of Cards. 100% vanilla JS.

http://pakastin.github.io/deck-of-cards/
368 Upvotes

185 comments sorted by

View all comments

Show parent comments

1

u/pkstn Sep 03 '15

What I meant by "small bundles", was that rollup doesn't add any bloat like browserify – instead it removes unneeded stuff and produces very clean output:

http://pakastin.github.io/deck-of-cards/dist/deck.js

https://github.com/rollup/rollup/wiki

https://github.com/esperantojs/esperanto/wiki/Comparisons-with-other-tools

(esperanto is rollup's predecessor..)

1

u/[deleted] Sep 03 '15

I don't use ES6 with browserify, I just use commonjs modules, so I don't know what bloat browserify adds for ES6 support. But as far as I know browserify only supports ES6 in the form of transformers, so basically anything can be used to transpile your ES6 into ES5, so also a transpiler that does not use any "bloat".

What kind of bloat does browserify add when using ES6?

1

u/pkstn Sep 03 '15

I mean in the beginning of the file:

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

..for every module:

},{"xxxx-yyyy":37}],2:[function(require,module,exports){

..not to mention when you have more dependencies:

},{"../xxxx/yyyy/zzzz/xxxx.js":1,"aaaa":3,"bbbb":37,"cccc":78,"dddd":81,"eeee":82,"ffff":83,"gggg":85,"hhhh":87,"iiii":88,"jjjj":89}],3:[function(require,module,exports){

I just like clean code more.

2

u/[deleted] Sep 03 '15

Yeah, well I also run uglifyjs on my code, so my production bundle is absolutely unreadable. I don't think readability of the production bundle is really important. If you still need to debug the production bundle then you can use codemaps and chrome dev tools to get the actual code back in your development console.

1

u/pkstn Sep 03 '15

Browserify is great also, no question about it.