-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
publish both cjs and esm version #105
Conversation
Hey @jiby-aurum, |
@garronej I can update the pr, such that |
@jiby-aurum in any case, thank you very much for your involvement. |
I can reproduce |
Don't worry about updating the PR. |
@garronej perfect! It should rather be me thanking you for the awesome project, would have been a pain to migrate away from |
@garronej I believe you will have to define the |
@jiby-aurum you 🪨 |
@garronej typescript "typesVersions": {
"*": {
"*": ["./dist/esm/*"]
}
}, |
@garronej btw you were correct about assuming it will work, it does work if the consuming project has but I think it makes more sense with the |
@garronej just tried |
@garronej sadly no, the normal imports complain now 😢 |
@jiby-aurum I'm still tweeking things |
@garronej I have a proposal, which is maybe the least friction change from current stable release.
{
"module": "dist/esm/index.js",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
},
"./mui": {
"import": "./dist/esm/mui.js",
"require": "./dist/mui.js"
}
},
} Im assuming I like this for the reasons that
|
Again thank you for helping me on this, I am strugling.
You assume correctly yes, gg for figuring that out by yourself.
Bummer, I was getting hyped, I want to try some more to make it work.. (it dosen't work though) It would be so cool not to have to tell users that use older TS version to import the module diferently. And we still have the problem of the default import not working, still trying to figure out how typesVersions realy works... |
@garronej I will push my proposal in this branch. And yes |
@garronej this branch now has my proposal, I tried it locally and it works properly in my project setup for |
Thank you!
Yes, I'm updating the script right now. |
"!dist/tsconfig.tsbuildinfo", | ||
"!dist/esm/test/", | ||
"!dist/esm/bin/", | ||
"!dist/esm/package.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, I just copied what was there for the cjs currently, did not really check if these files are generated
"exports": { | ||
".": { | ||
"import": "./esm/index.js", | ||
"require": "./index.js" | ||
}, | ||
"./mui": { | ||
"import": "./esm/mui.js", | ||
"require": "./mui.js" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok but we haven't the types that automatically resolve to compat.d.ts
and mui_compat.d.ts
with older typescript version...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garronej it makes sense if you want to use the compact types when typescript in consuming project is less than 4.4, but keep in mind that as you mentioned earlier this is only compile time, only the types changes, the implementation won't be the compact ones.
@jiby-aurum Let's forget about using |
Fixes issue with vite, where mui and tss-react imports different versions of
@emotion/react
, one being cjs and the other being esm.