Next.js Discord

Discord Forum

Changing to esmodule causes _document.js to throw an error

Unanswered
Vespid wasp posted this in #help-forum
Open in Discord
Vespid waspOP
Hello im trying to update my project to use esmodule by updating my package.json to use "type":"module" and changing the next.config.js to next.config.mjs but im encountering issue when running the app where I keep getting this error in my _document.js file

TypeError: Class extends value #<Object> is not a constructor or null

export default class MyDocument extends Document {


what change am i missing to apply to make it work?

Note that I am using Nextjs 14


Here is the link of someone having the same issue as I am

https://forum.freecodecamp.org/t/configuring-next-config-js-to-implement-image-tag/625444

1 Reply

Vespid waspOP