mongoose-zod icon indicating copy to clipboard operation
mongoose-zod copied to clipboard

Fix Webpack import.meta error

Open PfisterFactor opened this issue 10 months ago • 2 comments

This PR:

  • Fixes this error I kept getting with Webpack by changing the function to use just the import.meta.url rather than import.meta
Critical dependency: Accessing import.meta directly is unsupported (only property access is supported)

PfisterFactor avatar Apr 09 '24 20:04 PfisterFactor

Hey! I'm curious why you compile a server library with webpack? If you really can't avoid that, would making webpack resolve mongoose-zod to dist/index.cjs make the compilation possible (since the CJS version of the lib is not using import.meta)?

andreww2012 avatar Apr 18 '24 18:04 andreww2012

Hey! I'm curious why you compile a server library with webpack? If you really can't avoid that, would making webpack resolve mongoose-zod to dist/index.cjs make the compilation possible (since the CJS version of the lib is not using import.meta)?

I'll look into that. I was attempting to use this library within my NextJS project and by default this is the error that you get without configuring anything. I believe NextJS compiles with CommonJS.

PfisterFactor avatar Apr 18 '24 19:04 PfisterFactor