This repository was archived by the owner on Jan 16, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 318
How does it work
Barry Staes edited this page Mar 5, 2015
·
3 revisions
-
package.jsonscripts -
webpack-dev-server.config.js,webpack-hot-dev-server.config.js,webpack-production.config.js make-webpack-config.js
-
reactvianpm=>package.json -
jsx-loader=>make-webpack-config.jsloaders
-
react-routervianpm=>package.json - Client-Side
config/app.jsx-
-
Router.run2.chargeStoreswith timeout 3.React.render
-
- Prerendering
config/prerender.jsx-
-
Router.run2.chargeStores3.React.renderToString4. generate HTML
-
- Loaders configured in
make-webpack-config.js - Development
style-loader- Why? It's fast and easy.
- Production
-
ExtractTextPlugin=>[name].css - in additional chunks:
style-loader - Why? With prerendering you need this to avoid FOUC. On demand loaded stuff doesn't need it and we include CSS in JS chunk to save requests.
-
- Prerendering
null-loader- Why? There is no DOM. We cannot run the
style-loader
-
url-loaderandfile-loaderconfigured inmake-webpack-config.js - Required resources are either embeddes as DataUrl or copied to the output directory.
- Why? Easy to handle for the developer. DataUrls save requests and roundtrips.
react-proxy-loader- uses Code Splitting
- Why? You want to keep the initial download small in big applications. You don't need this in small applications.
-
webpack-dev-serverinpackage.json - Hot Module Replacement
- see
react-hot-loader -
style-loaderreplaces CSS
- see
-
devtool: "eval"for performance - Why? Speeds up development.
- Hashes are added to
output.filename,CommonsChunkPluginandExtractTextPlugin -
file-loaderuses hashes by default. - see
make-webpack-config.js - Why? All assets can be cached forever.
- JS:
UglifyJSPlugin - CSS:
css-loaderminimizes - Why? To reduce the download time
- Loaders preconfigured in
make-webpack-config.js - Loader need to be installed when used.
- Why? The configuration does cost anything. They are not installed because this would be expensive even for users that doesn't use xxx.