You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started using Material-tailwind + Remix + Vite, but I am getting the following errors. You can see it on Stackblitz.com
[vite] Named export 'Collapse' 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 {Navbar, Typography, Button, IconButton, Collapse} = pkg;
so, I changed it to:
import { default as material } from "@material-tailwind/react";
const { Navbar, Typography, Button, IconButton, Collapse } = material;
and it didn't raise error, but see the following error in Chrome browser console:
Uncaught TypeError: Cannot destructure property 'Navbar' of 'material' as it is **undefined**.
I checked the dowloaded package(i.e. http://localhost:4000/node_modules/.vite/deps/@material-tailwind_react.js?v=a54f6275), I see this.
Thanks @cognvn! Interestingly, using the legacy flag didn't help. But by checking the shared vite document, I noticed I only tested the first workaround, so I tried the second one (i.e. use import * as material from ...) and it worked! although it is for dev and it failed in production.
As you said, the proper workaround is using the vite-plugin-cjs-interop lib until Material-Tailwind build esm module output too.
I started using Material-tailwind + Remix + Vite, but I am getting the following errors. You can see it on Stackblitz.com
so, I changed it to:
and it didn't raise error, but see the following error in Chrome browser console:
I checked the dowloaded package(i.e.
http://localhost:4000/node_modules/.vite/deps/@material-tailwind_react.js?v=a54f6275
), I see this.which is a bit confusing. Any help? I am a bit suspecious to something like this: vitejs/vite#10612
The text was updated successfully, but these errors were encountered: