How to develop reusable components with Babel and Rollup.js

How to develop reusable components with Babel and Rollup.js

We quite often develop nice features and tools for ourselves. Learning how to make it reusable and how to publish to the community is a must.

86d69b8300d46636769c0bf2c133796d?s=128

Hugo Nogueira

October 10, 2018
Tweet

Transcript

  1. 1.

    HOW TO DEVELOP REUSABLE COMPONENTS WITH rollup.js AND HUGO NOGUEIRA

    Engineering Lead @ BCG Digital Ventures hello@hugomagalhaes.com hugomn
  2. 2.

    WHO AM I? Engineering lead @ BCG Digital Ventures. Passionate

    about front-end development, mainly with React + Redux in with Berlin for 2 years
  3. 4.

    Use your component as a micro-service front-end application To share

    configuration (constants, settings) as components between different applications To be able to reuse your components between different applications
  4. 6.
  5. 11.
  6. 12.

    Asynchronous Module Definition (AMD) Born as CommonJS wasn’t suited for

    the browsers early on. As the name implies, it supports asynchronous loading.
  7. 13.

    Asynchronous Module Definition (AMD) The function is called only when

    the requested modules are finished loading. The define function takes the first argument as an array of dependency modules. These modules are loaded in a non-blocking manner in the background and once the loading is completed, the callback function is executed.
  8. 15.

    ES2015 Modules Implemented in the the latest ECMAScript 2015, and

    is compatible with both synchronous and asynchronous approaches.
  9. 16.

    ES2015 Modules Isn’t fully implemented in the browsers and it

    requires a transpiler like Babel to render in the unsupported browsers.
  10. 18.
  11. 20.
  12. 21.

    Webpack was created mainly as a bundler for web apps,

    to solve issues like code-splitting and assets managament.
  13. 22.

    Even thought both libraries have grown crazily recently, the conventional

    wisdom has been: “Use webpack for apps, and Rollup for libraries”