Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Webpack and React

sporto
March 03, 2015

Webpack and React

Webpack is a great fit for React.js applications, this decks explains the major features of Webpack

sporto

March 03, 2015
Tweet

More Decks by sporto

Other Decks in Technology

Transcript

  1. CommonJS :) module.exports = React.createClass({ ... }) var List =

    require('./list') React.render(<List />, ...)
  2. Loaders loaders: [ { test: /\.css/, loader: "style-loader!css-loader" }, {

    test: /\.jsx$/, loader: "jsx-loader?stripTypes" }, ...
  3. CSS Code Images Fonts JS JSX ES6 Coffee Less Sass

    SVG Jpeg png eot ttf Templates
  4. Loaders can have parameters Read JSX Remove Flow annotations Output

    JS { test: /\.jsx$/, loader: "jsx-loader?stripTypes" },
  5. Loaders can be chained Convert LESS to CSS Loads CSS

    Inject CSS in document { test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
  6. On demand require.ensure(["foo", "bar"], function(require) { var foo = require("foo");

    // ... }); load foo and bar on demand exec the rest
 when loaded
  7. NPM integration ★ Install libs using NPM ★ Package.json for

    dependencies ★ Use NPM packages from your code