The top-level-await experiment is not enabled

When we try to call an async function with await from a .tsx file in a Next.js React TypeScript web application we get the error message: Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) Error: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) The …

Module not found: Can’t resolve ‘fs’

If you use Webpack version 5 or later you may encounter the error message Module not found: Can’t resolve ‘fs’ The cause is, that Webpack 5 has a breaking change, and the “fs” module is most likely not included anymore in the client-side code. To eliminate the issue, add the “browser” element to the package.js …

Linking between pages in multi page Next.js React web applications

The Next.js React sample project only contains a single “Index” page. If your web site has multiple pages, you need to set up simple routing to call them from each other. In this example we will use the “Link” Next.js React component to call two pages from each other with the minimum number of instructions …