Skip to content

Conversation

PfisterFactor
Copy link

@PfisterFactor PfisterFactor commented Apr 9, 2024

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)

@andreww2012
Copy link
Owner

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants