Skip to content

fix: copy zod types instead of bundling them#10222

Merged
chenjiahan merged 1 commit intomainfrom
fix/zod-import
Apr 28, 2025
Merged

fix: copy zod types instead of bundling them#10222
chenjiahan merged 1 commit intomainfrom
fix/zod-import

Conversation

@Timeless0911
Copy link
Contributor

Summary

In #9899, I use default import to import zod to make types clear like below.

image

But if user use named import in daily development, the types will be emitted like:

image

And there exists an ast-grep issue when we try to redirect the import path, see ast-grep/ast-grep#1959

Since the named import is the recommended one, so this PR, we use named import to import zod uniformly, and modify the prebundle script to copy the dts file directly instead of using rollup-plugin-dts for bundling to avoid the ast-grep issue and make the types simple and clear.

BTW, zod use namespace and rollup-plugin-dts has some issues for namespace support, so we just use copy when prebundle.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Apr 28, 2025
@netlify
Copy link

netlify bot commented Apr 28, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit bfc0ee5
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/680f21426035c20008b44eec

@Timeless0911 Timeless0911 changed the title optimize: copy zod types instead of bundle chore(optimize): copy zod types instead of bundling them Apr 28, 2025
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenjiahan chenjiahan changed the title chore(optimize): copy zod types instead of bundling them fix: copy zod types instead of bundling them Apr 28, 2025
@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Apr 28, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 28, 2025

CodSpeed Performance Report

Merging #10222 will not alter performance

Comparing fix/zod-import (bfc0ee5) with main (0d79475)

🎉 Hooray! codspeed-rust just leveled up to 2.7.2!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 11 untouched benchmarks

@chenjiahan chenjiahan enabled auto-merge (squash) April 28, 2025 07:09
@chenjiahan chenjiahan merged commit da997a6 into main Apr 28, 2025
49 of 53 checks passed
@chenjiahan chenjiahan deleted the fix/zod-import branch April 28, 2025 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants