Closed as not planned
Description
This error occurred only after switching from the regular react plugin to the react-swc plugin. The exact error is:
Uncaught SyntaxError: The requested module '/src/types/devices.ts?t=1692279660309' does not provide an export named 'Device' (at AddDevicePopup.tsx:11:10)
In my scenario I have a React component that imports a type and a styled component with the same name:
AddDevicePopup.tsx
import { Device } from '@types/devices';
import * as S from "./AddDevicePopup.styled"; // includes S.Device
devices.ts
export type Device = {};
AddDevicePopup.styled
export const Device = styled.button;
It seems that even though the styled component Device is imported under the namespace S
it somehow collides with the exported type Device
and breaks my app. When renaming either the exported type or the styled component it works fine. So the workaround is easy but this seems like an issue that should resolved.