codeschool / WatchUsBuild-React

Code sample for the Watch Us Build episode that focused on React
http://codeschool.github.io/WatchUsBuild-React/demo
120 stars 117 forks source link

How about enabling cache options for Browserify? #5

Open leehankyeol opened 7 years ago

leehankyeol commented 7 years ago

After coding for a while, my bundle() started to take about 4-5 seconds, which is quite a lot when developing an app. So I googled around and found out I can actually enable cache options for Browserify.

In gulpfile.bable.js, I changed the following code (btw there're duplicated watchify.args.debug = true; in the code.)

// Input file.
watchify.args.debug = true;
var bundler = browserify('src/app.js', watchify.args);

into

// Input file.
var bundler = browserify({
  entries: ['src/app.js'],
  cache: {},
  packageCache: {},
  debug: true,
  plugin: [watchify],
});

and now bundling became much faster than before. Not really sure that what I've done makes sense so if there's anything wrong please let me know.

Always enjoying your courses and screencasts, thanks!

xgqfrms-GitHub commented 7 years ago

??? Underscore ._getComments() error

Underscore helps distinguish custom methods from React methods

http://underscorejs.org/

how to import this lib & where ?

______________________________________________

const comments = this._getComments();

// Underscore

Underscore helps distinguish custom methods from React methods

New method that will return array of JSX elements

_getComments() {
    const commentList = [
        { id: 1, author: 'Morgan McCircuit', body: 'Great picture!' },
        { id: 2, author: 'Bending Bender', body: 'Excellent stuff' }
    ];
    return commentList.map(() => {
        return (<Comment />);
    });
}
______________________________________________