Skip to content

Fix types for CJS projects using TypeScript NodeNext/Node16 #277

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

Merged
merged 1 commit into from
Oct 9, 2022

Conversation

frehner
Copy link
Contributor

@frehner frehner commented Oct 9, 2022

Followup to #267 and #275

Tested both ESM and CJS projects (by modifying the example package) and this works.

@changeset-bot
Copy link

changeset-bot bot commented Oct 9, 2022

🦋 Changeset detected

Latest commit: 18f3d2b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@ladle/react Patch
example Patch
test-addons Patch
test-config Patch
test-config-ts Patch
test-css Patch
test-decorators Patch
test-flow Patch
playwright Patch
test-programmatic Patch
test-provider Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 9, 2022

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

Name Status Preview Updated
ladle ✅ Ready (Inspect) Visit Preview Oct 9, 2022 at 7:05PM (UTC)

@@ -28,7 +28,7 @@
"clean": "rimraf dist && rimraf .ladle && rimraf build && rimraf *.tsbuildinfo",
"serve": "node ./lib/cli/cli.js serve",
"test": "cross-env IMPORT_ROOT=\"./\" vitest",
"types": "tsc --project tsconfig.typesoutput.json"
"types": "tsc --project tsconfig.typesoutput.json && cp ./lib/app/exports.d.ts ./lib/app/exports.d.cts"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cp won't work across platforms (e.g. windows) - would you like me to include something like https://www.npmjs.com/package/cpy-cli so that it does, or are you ok with this as it will generally only run in CI/CD processes?

Copy link
Owner

Choose a reason for hiding this comment

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

yea, this doesn't need to be x-platform

@tajo tajo merged commit 6245aa7 into tajo:main Oct 9, 2022
@tajo tajo mentioned this pull request Oct 9, 2022
@frehner
Copy link
Contributor Author

frehner commented Oct 10, 2022

Frustrating:

The Stackblitz appears to still not be working.

But in a real project, I can update to the latest next version and test both ESM and CJS and they work.

I'm not sure why the Stackblitz isn't working... but it does seem to work in the "real world."

Hmm.

@frehner frehner deleted the cjs-package-exports branch October 10, 2022 01:11
@frehner
Copy link
Contributor Author

frehner commented Oct 10, 2022

And just retested it from the example package and it works there too. Hm.

At this point I think it may be a Stackblitz thing more than anything?

@tajo
Copy link
Owner

tajo commented Oct 11, 2022

@frehner tried to publish the stable version, a bit strange error: https://github.com/tajo/ladle/actions/runs/3229204374/jobs/5286226320#step:8:12

@frehner
Copy link
Contributor Author

frehner commented Oct 11, 2022

@tajo Ah, I think that happened because we generated the type files for publishing the normal version, and then tried to generate the type files again to publish the next version.

Hmmm, thoughts?

@tajo
Copy link
Owner

tajo commented Oct 12, 2022

Ah yea, that makes sense

@frehner
Copy link
Contributor Author

frehner commented Oct 12, 2022

Do you want me to add additional logic to try and fix this? Do you have an idea of how you would like it done?

@tajo
Copy link
Owner

tajo commented Oct 12, 2022

Do you want me to add additional logic to try and fix this?

Help is always appreciated!

Do you have an idea of how you would like it done?

I think it still makes sense to publish next version together with the stable version (you never want to end up with outdated version after installing @next).

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