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

Support for Astro v4 #661

Closed
r1y4h opened this issue Mar 31, 2024 · 2 comments
Closed

Support for Astro v4 #661

r1y4h opened this issue Mar 31, 2024 · 2 comments

Comments

@r1y4h
Copy link

r1y4h commented Mar 31, 2024

In Astro v3, the documented way of importing works fine for both server side and client side rendering:

import { Button } from '@material-tailwind/react';

In Astro v4, the above works fine for client side rendering.

But if you try this in Astro v4 SSR, Vite will throw an error:

[vite] Named export 'Button' not found. The requested module '@material-tailwind/react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@material-tailwind/react';
const {Button} = pkg;

We should be able to import material-tailwind components the same way for both SSR and CSR, so we can fully take advantage of Astro Islands concept.

@r1y4h
Copy link
Author

r1y4h commented Apr 2, 2024

It seems Astro v4 SSR only supports ESM modules while material-tailwind still uses CommonJS. Thus the problem. Will you convert material-tailwind to use ESM instead? @sajadevo

@r1y4h
Copy link
Author

r1y4h commented Apr 2, 2024

Reported this to Astro, and they would fix this on their end:
withastro/astro#10654

@r1y4h r1y4h closed this as completed Apr 3, 2024
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

No branches or pull requests

1 participant