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

feat!: move to ESM first with dual ESM/CJS subpackage exports #881

Closed
wants to merge 8 commits into from

Conversation

userquin
Copy link

@userquin userquin commented Apr 7, 2024

Related Issues or Discussions

Talk with Kato and Moha in discord.

Summary

Move to ESM first and include subpackage exports.

This PR also includes:

  • now using rollup-plugin-dts instead typescript to generate dts files
  • remove useProxy from src/macro.ts module and patch the d.ts and d.cts files
  • change build to run build:all: now we can generate multiples outputs (d.mts, d.cts and d.ts) and also the ts3.4 version, we need to play with the target and maybe lib to fix ts3.4
  • ts3.4 now inside dist folder: we should include only dist in files (package.json)
  • postbuildnow includes only yarn copy, I've left old xpostbuild, we should remove it later
  • copy script now copy src and esm from root, I've left old xcopy, we should remove it later: why copying src folder to remove it in the next script?

Check List

  • yarn run prettier for formatting code and docs

Copy link

vercel bot commented Apr 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
valtio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2024 9:07pm

Copy link

codesandbox-ci bot commented Apr 7, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

# Conflicts:
#	tests/memoryleaks.test.ts
@@ -1,49 +1,67 @@
{
"name": "valtio",
"type": "module",
Copy link
Member

Choose a reason for hiding this comment

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

ugh, unfortunately, this is not acceptable. we try to keep cjs first. we plan esm first for valtio v3.

Copy link
Author

Choose a reason for hiding this comment

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

This pr is for main, I can send another pr using commonjs to v2 branch (this PR should be closed)

@dai-shi
Copy link
Member

dai-shi commented Apr 8, 2024

I can send another pr using commonjs to v2 branch (this PR should be closed)

Sounds good. This PR introduces too many changes and can't even see if there are breaking changes or not. I'm pretty sure it breaks some old environments.

I would appreciate if you can send small PRs. For example: #882 (well, it's exceptionally small.)

@dai-shi dai-shi closed this Apr 8, 2024
},
"./*": {
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why we need to avoid subpath patterns?

@dai-shi
Copy link
Member

dai-shi commented Apr 8, 2024

small PRs

At least, we should separate for different issues: a) fix the result in dist and b) fix for tests, which may depend on a).

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