Created
October 6, 2014 18:29
-
-
Save ericclemmons/5619139740be169e08ff to your computer and use it in GitHub Desktop.
Gulp + Webpack + React is SLOW
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @jsx React.DOM | |
*/ | |
var React = require('react'); | |
var Router = require('react-router'); | |
var Routes = Router.Routes; | |
var Route = Router.Route; | |
var DefaultRoute = Router.DefaultRoute; | |
var App = require('./app.jsx'); | |
var Home = require('./home/home.jsx'); | |
var School = require('./schools/school.jsx'); | |
var Schools = require('./schools/schools.jsx'); | |
React.renderComponent(( | |
<Routes location="hash" handler={App}> | |
<DefaultRoute handler={Home} /> | |
<Route path="/schools" name="schools" handler={Schools} /> | |
<Route path="/schools/:schoolId" name="school" handler={School} /> | |
</Routes> | |
), document.body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// snip | |
gulp.task('webpack', function() { | |
return gulp | |
.src('app/scripts/bootstrap.jsx') | |
.pipe($.webpack({ | |
cache: {}, | |
// devtool: 'inline-source-map', | |
// entry: { | |
// bootstrap: './app/scripts/bootstrap.jsx', | |
// vendors: './app/scripts/vendors.js', | |
// }, | |
module: { | |
loaders: [ | |
{ test: /\.jsx?$/, loader: 'jsx' } | |
], | |
}, | |
output: { | |
filename: '[name].bundle.js', | |
chunkFilename: '[id].bundle.js', | |
}, | |
plugins: [ | |
// new webpack.optimize.CommonsChunkPlugin('common.bundle.js') | |
], | |
resolve: { | |
modulesDirectories: ['bower_components', 'node_modules'], | |
}, | |
}, webpack)) | |
.pipe(gulp.dest('app/build')) | |
; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp webpack | |
[13:29:01] Using gulpfile ~/Projects/ericclemmons/AdminMVC/react/gulpfile.js | |
[13:29:01] Starting 'webpack'... | |
[13:29:03] Version: webpack 1.4.4 | |
Asset Size Chunks Chunk Names | |
main.bundle.js 790039 0 [emitted] main | |
[13:29:03] Finished 'webpack' after 1.9 s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment