Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gulp + Webpack + React is SLOW
/**
* @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);
// 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'))
;
});
 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