Open mahmoudmoravej opened 2 months ago
I have same problem with Remix and I'm able to fix it with:
export default defineConfig({
plugins: [remix(), tsconfigPaths()],
+ legacy: { proxySsrExternalModules: true },
});
Read more at Vite docs
... but it only works on dev
or ssr: false
.
Consider using vite-plugin-cjs-interop
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: https://github.com/vitejs/vite/issues/10612