Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when using zod with skypack #309

Closed
yqrashawn opened this issue Feb 4, 2021 · 4 comments
Closed

error when using zod with skypack #309

yqrashawn opened this issue Feb 4, 2021 · 4 comments

Comments

@yqrashawn
Copy link

image
same error if runs in browser

<!DOCTYPE html>
<html lang="en">
  <body>
    <script type="module">
      import z from 'https://cdn.skypack.dev/zod';
      z.string().parse('fish')
    </script>
    <script type="module">
      import * as z from 'https://cdn.skypack.dev/zod';
      z.string().parse('fish')
    </script>
  </body>
</html>
@jacksteamdev
Copy link

jacksteamdev commented Feb 26, 2021

This is likely tied to #175

Skypack is based on ESM, and zod doesn't currently play nice with ESM.

@colinhacks
Copy link
Owner

@yqrashawn @jacksteamdev I'm working now to refactor Zod to eliminate circular imports (the root issue of the ESM incompatibility). Zod 3 should be available as an ESM module within the week.

@colinhacks
Copy link
Owner

I just released the newest v3 alpha (zod@3.0.0-alpha.7) which includes ES module support.

@yqrashawn can you try https://cdn.skypack.dev/zod@3.0.0-alpha.7 and let me know if it works?

@yqrashawn
Copy link
Author

I just released the newest v3 alpha (zod@3.0.0-alpha.7) which includes ES module support.

@yqrashawn can you try https://cdn.skypack.dev/zod@3.0.0-alpha.7 and let me know if it works?

This works fine in deno and browser now.

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

No branches or pull requests

3 participants