Closed mledwards closed 1 year ago
Oh, I also have this in the next.config.js
const nextConfig = {
env: {
DEBUG: process.env.NODE_ENV === "development" ? "boilerplate:*" : "",
}
};
debug
is an ESM package. Try using import
.
Going to close this unless there's something else!
debug
is an ESM package. Try usingimport
.
I changed this to
import debugPackage from "debug"
const debug = debugPackage("boilerplate:home");
but got the same issue.
I think the problem is this line DEBUG: process.env.NODE_ENV === "development" ? "boilerplate:*" : "",
line. In Next 13.4+ App Router approach it looks like I didn't need it anymore, just setting the DEBUG env var seems to work.
Thanks for the response!
https://github.com/debug-js/debug/blob/master/src/node.js#L205
It seems the code will cause Next.js to fail when using DEBUG=xxx:* npm run dev
When I comment it, the issue is gone.
I've added this debug line to the server side template
layout.tsx
of a Next.js v13.5 project, and I'm getting this error.Any ideas what could be causing this?