From CommonJS to ES Modules: How to modernize your Node.js app

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

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • ESLint

    Find and fix problems in your JavaScript code.

    I recommend to use prettier and eslint. It’s optional, but it will make your life a lot easier. We need to modify every single file and those tools help us to keep the formatting consistent, while also checking errors we overlooked. Especially the eslint plugin “eslint-plugin-import” has rules that are relevant for us. Rules that verify our imports. Make sure to configure at least import/no-unresolved, import/no-commonjs and import/extensions.

  • eslint-plugin-import

    ESLint plugin with rules that help validate proper imports.

    I recommend to use prettier and eslint. It’s optional, but it will make your life a lot easier. We need to modify every single file and those tools help us to keep the formatting consistent, while also checking errors we overlooked. Especially the eslint plugin “eslint-plugin-import” has rules that are relevant for us. Rules that verify our imports. Make sure to configure at least import/no-unresolved, import/no-commonjs and import/extensions.

  • 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.

  • cjs-to-es6

    Discontinued CLI to convert CommonJS to ES6 modules (UNMAINTAINED)

    cjs-to-es6 is a CLI that converts JavaScript files from CommonJS to ES6 Modules. It’s unmaintained, but still the best tool I could find. It successfully ported around 80% of my files. That’s fine. Both modules systems are different and not everything can be converted 1:1.

  • c8

    output coverage reports using Node.js' built in coverage

    Are you using nyc (the Istanbul command line interface that reports the code covered by your tests)? It’s not ready for the future, yet. The good thing is that V8 (the JavaScript engine behind Node.js) has code coverage built-in. You can take advantage of it using c8. A CLI similar to nyc. And because it relies on the build-in V8 code coverage it always works with the newest syntax supported by Node.js.

  • v8.dev

    The source code of v8.dev, the official website of the V8 project.

    Are you using nyc (the Istanbul command line interface that reports the code covered by your tests)? It’s not ready for the future, yet. The good thing is that V8 (the JavaScript engine behind Node.js) has code coverage built-in. You can take advantage of it using c8. A CLI similar to nyc. And because it relies on the build-in V8 code coverage it always works with the newest syntax supported by Node.js.

  • prettier

    Prettier is an opinionated code formatter.

    I recommend to use prettier and eslint. It’s optional, but it will make your life a lot easier. We need to modify every single file and those tools help us to keep the formatting consistent, while also checking errors we overlooked. Especially the eslint plugin “eslint-plugin-import” has rules that are relevant for us. Rules that verify our imports. Make sure to configure at least import/no-unresolved, import/no-commonjs and import/extensions.

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