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:
> node_modules/material-table/node_modules/@material-ui/pickers/esm/index.js:4:9: error: No matching export in "node_modules/material-table/node_modules/@material-ui/pickers/esm/DateTimePicker/index.js" for import "DateTimePickerProps"
4 │ import { DateTimePickerProps, KeyboardDateTimePickerProps } from './DateTimePicker';
// index.js
// this line is emitted but there is no export for it in ./DateTimePicker
import { DateTimePickerProps, KeyboardDateTimePickerProps } from './DateTimePicker';
[ ] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[ ] Provide a description in this issue that describes the bug.
[ ] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
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