Add Rollup Configuration - CJS / IIFE / ES | Building an NPM Package with TypeScript

Описание к видео Add Rollup Configuration - CJS / IIFE / ES | Building an NPM Package with TypeScript

We will set up the build tool to create our final library file. To understand what will be created, we first need to talk about the different types of bundles a bundler can create.

  / add-rollup-configuration-building-an-npm-p...  

JavaScript libraries can run in different environments. They can be made to run on the web, for old browsers, for new browsers. They can be made to run on NodeJS, old and new versions.
For our library, we are going to use Rollup as our module bundler. A module bundler such as Rollup aims to bundle your source code from an entry point file to an endpoint file, making some transformation in the process. In our situation, we are going to have an index.ts file as an entry point. All of our files are imported from this file onwards. Rollup will apply the transformation necessary, such as TypeScript transpilation via plugins.
As mentioned previously, JavaScript can run in different environments. It also has a vast, chaotic history that translates in multiple formats to create a bundle. The first format to talk about is “immediately invoked function expression.”

Комментарии

Информация по комментариям в разработке