Closed Nick-Lucas closed 3 years ago
Could you try to adapt the workaround described here: https://github.com/vitejs/vite/issues/1853#issuecomment-805605644?
Yes looks like that sorts it, adding an alias like this:
resolve: {
alias: [
{
find: /^@material-ui\/pickers$/,
replacement: resolve(__dirname, "./node_modules/@material-ui/pickers/esm"),
}
]
}
Thanks for the advice!
This should be fixed by #2976 / #3282, released in v2.3.0
Describe the bug
When using material table in a vite react project, it is possible to run a production build with some warnings, but the development build fails when precompiling dependencies. This appears to be because Material UI emits typscript interfaces into the JS code as imports, and those imports do not exist in the source file, material UI has been like this for at least a couple years, so it seems to be a Vite issue.
So you get errors like this:
Reproduction
Reproduction here: https://github.com/Nick-Lucas/vite-mui-bug
Basic steps for a fresh reproduction:
yarn create @vitejs/app
with react and typescriptyarn dev
- errorSystem Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager:
Logs
Before submitting the issue, please make sure you do the following