Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ES Modules in a Next.js server.js

I checked a few examples from the Next.js repository

  • https://github.com/zeit/next.js/tree/master/examples/custom-server-express
  • https://github.com/zeit/next.js/tree/master/examples/custom-server-koa

and noticed that examples use ES Modules in React components and CommonJS modules in the server.js file. I'd like to keep my code written in one style, is it possible to use only ES Modules in a Next.js project?

like image 841
Andrei Belokopytov Avatar asked Jun 07 '26 02:06

Andrei Belokopytov


1 Answers

This is sitting as a feature request in the Next.js backlog. https://github.com/zeit/next.js/issues/9607

like image 109
Paul Hale Avatar answered Jun 08 '26 15:06

Paul Hale