Articles tagged in: Node.js



Bun — Detect the Version at Runtime

Sometimes you need to detect the version running your code at runtime. You may need this to ensure that your code runs with a required version of Bun. This tutorial shows you how to detect the Bun version, that runs your code, at runtime. {{outline}} Determine the Bun Version Running …

Continue Reading

Node.js — How to Fix ESM Error “Directory import is not supported resolving ES modules imported”

ECMAScript modules are an official standard describing a format on how to write reusable JavaScript code. Browsers used ECMAScript modules and Node.js had their own module loading implementation: CommonJS. Node.js added full ESM support starting from version 12. At the time of writing this tutorial, developers migrate their …

Continue Reading

JavaScript — Cache Computation Results in a Local Variable

We’re using a small performance optimization in our code bases: caching computation results in local variables. Saving results in a local variable is borrowed from the memoization technique. Memoizing values improves the performance of function execution by storing the results and reusing them for a function call. This tutorial …

Continue Reading

JavaScript — Prevent Line Breaks in String Template Literals

Template literates in JavaScript are delimited with backticks and allow you to create string interpolation and multi-line strings. A multi-line string with template literals is convenient because you can add words and line breaks without concatenating strings using a + across lines. A downside of multi-line strings in template literals: it …

Continue Reading
Page 1 of 43

Explore the Library

Find interesting tutorials and solutions for your problems.