Closed petter closed 4 months ago
I'm guessing it comes from attempting to requiring the package during instantiation. Would a require.resolve()
check be a workaround for this? 🤔
I've looked some more into this. It seems that whenever there is a require
somewhere in a file, webpack will try to resolve it. Even if the require
expression is never run. Because of this there doesn't seem to be a simple fix for this issue.
Since this is only an issue in Next.js with webpack (AFAIK) it isn't a big deal for us at least since turbopack will soon be the new standard anyways.
I'm trying to use
@elastic/ecs-pino-format
in my Next.js app, and it's working mostly fine. However, whenever a logger instance is created I get the following error in my console:This seems to only happen during development in a Next.js app not using turbopack, so it's not a huge issue. Is there any way to stop these log messages?
Also seems to happen with the
@elastic/ecs-winston-format
package.Reproduction
CodeSandbox