-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
package gets resolved as commonjs from an esm project #372
Comments
Could you try out the version from this PR: #373 ? |
I got an error when trying to build it:
|
🙈 I forgot to commit those two files. Could you try again now? |
Now it builds successfully for me 🚀 Edit: tested on vite/next.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, I recently stumbled upon some weird behavior while using another library that uses your package, the library is https://github.com/nextui-org/nextui v2
I am kinda out of options, cause I am struggling to figure this out myself
I am using ts + vite + vite-plugin-ssr with default configs
But got the same behavior using next.js as well
While bundling the project I got an error that
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
I created an issue for this nextui-org/nextui#1160
The gist of it is that your package gets resolved as commonjs from an esm project (vite uses esm by default either way I think) and then the cjs exports the component as
module.exports.default =
but esm treats default exports from commonjs asmodule.exports =
not asmodule.exports.default =
So when nextui-org imports your package it gets imported as
{default: ..component..}
which is not a component and it failsMore info nextui-org/nextui#1160
I am not sure if this is because of a bad vite config, but I don't think so, because I checked your package with https://arethetypeswrong.github.io/?p=react-textarea-autosize%408.4.1 and just as I thought
node16-esm
resolves your package to cjs:Screenshot from the website
Thanks
The text was updated successfully, but these errors were encountered: