-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Can't bundle clsx with rollup: clsx_1.default is not a function #27
Comments
clsx provides es modules which should just work for rollup without commonjs plugin. Could you provide full config? |
I think it's because I have a dependency that is commonjs and it's using clsx. It may be that rollup is just not smart enough to handle this situation without that setting. I thought it may be useful to someone else since clsx is a very commonly used library. Here is where they talk about that setting, which is actually fairly new in rollup: https://www.npmjs.com/package/@rollup/plugin-commonjs#requirereturnsdefault If you remove that setting it will fail at runtime because it can't find the default export from clsx. Here is my rollup config:
|
Try |
Yeah, this looks new from For clsx, and presumably any package that uses clsx can't migrate away from default exports because it's meant to be a drop-in replacement for classnames. Modifying exports would lose the ability for aliasing at the build and install levels. Closing this as there's unfortunately nothing we can do on our end. It'd be a README call-out, at best. Thank you @TrySound for helping out! |
I think it might be similar to this issue I found: jednano/tsx-react-postcss-webpack#1
rollup 2.26.11
@rollup/plugin-node-resolve@9.0.0
@rollup/plugin-commonjs 15.0.0
Right before posting this I found a workaround, adding
requireReturnsDefault
to commonjs pluginThe text was updated successfully, but these errors were encountered: