Setting Up a JavaScript Build Process using Rollup

This page summarizes the projects mentioned and recommended in the original post on dev.to

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • plugins

    🍣 The one-stop shop for official Rollup plugins (by rollup)

  • And then one Rollup plugin to integrate Babel:

  • browserslist

    🦔 Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-preset-env

  • The env preset is a smart preset that uses Browserlist under the hood to determine which syntax is best to transpile to. The final step is to let Rollup know that it should call babel during the bundling process. To do so we are going to update the Rollup configuration file:

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • rollup-plugin-terser

    Discontinued Rollup plugin to minify generated bundle

  • Generating a bundle that has many dependencies, from our code or third-party packages, will result in a large JavaScript file. To optimize the bundle it is useful to integrate Terser into our build process. What Terser does is it removes comments, shorten variables names, cut whitespaces and minify our code to make it the shortest possible. Again Terser can be integrated with Rollup using a plugin:

  • rollup-plugin-postcss

    Seamless integration between Rollup and PostCSS.

  • To process Less files we will use PostCSS, which is a JavaScript build tool for CSS, Less, and other CSS preprocessors. It also comes with a built-in minifier. We can add it to the project with a Rollup plugin:

  • autoprefixer

    Parse CSS and add vendor prefixes to rules by Can I Use

  • One of the most interesting features of PostCSS is Autoprefixer. Much like Babel, it checks our browserslist requirement to add prefixes to CSS rules, ensuring cross-browser compatibilities. We can add it to the project with the following command:

  • Less

    Leaner CSS, in your browser or Ruby (via less.js).

  • Now that we have addressed our scripts, we can focus on our styles. In this setup, we will look at the CSS preprocessor Less which lets us write CSS simpler, use variables and mixins. We can add it to the project with the following command:

  • ESLint

    Find and fix problems in your JavaScript code.

  • ESLint is a linter, a program that will analyse our code to correct syntax and detect problems (missing brackets/parentheses, unused variables, etc.) during the build process. We are first going to add it to our project:

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • d3

    Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

  • Some third-party libraries like d3.js will have circular dependencies within them, which Rollup will warn us about when building the module. To avoid getting many warning messages, we can add a warning filter to in the Rollup configuration:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Introducing Vigex - PRO Regex Builder 🔥

    5 projects | dev.to | 1 Mar 2022
  • Shared Data-Layer Setup For Micro Frontend Application with Nx Workspace

    4 projects | dev.to | 25 Apr 2024
  • Shared Tailwind Setup For Micro Frontend Application with Nx Workspace

    6 projects | dev.to | 29 Mar 2024
  • Future of CSS: Functions and Mixins

    3 projects | dev.to | 15 Feb 2024
  • Why it is Important to Update Linters and How to Do it Right

    4 projects | dev.to | 8 Feb 2024