andreww2012 / mongoose-zod

A library which allows to author mongoose ("a MongoDB object modeling tool") schemas using zod ("a TypeScript-first schema declaration and validation library").
MIT License
49 stars 7 forks source link

Fix Webpack import.meta error #17

Open PfisterFactor opened 7 months ago

PfisterFactor commented 7 months ago

This PR:

Critical dependency: Accessing import.meta directly is unsupported (only property access is supported)
andreww2012 commented 7 months ago

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)?

PfisterFactor commented 7 months ago

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.