On Github AbilashK / webpack-talk
// webpack.config.js module.exports = { entry: './main.js', output: { filename: 'bundle.js' } };
if (window.location.pathname === '/feed') { showLoadingState(); require.ensure([], function() { // On demand load hideLoadingState(); require('./feed').show(); }); } else if (window.location.pathname === '/profile') { showLoadingState(); require.ensure([], function() { hideLoadingState(); require('./profile').show(); // Code splitting }); }
// webpack.config.js module.exports = { entry: './main.js', output: { path: './build', filename: 'bundle.js' }, module: { loaders: [ { test: /\.css$/, loader: 'style-loader!css-loader' }, // inline base64 URLs for <=8k images, direct URLs for the rest { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' } ] } };