Skip to content

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. #1080

Discussion options

You must be logged in to vote

Actualization

As I am using react-swipeable-views, for ts projects there are necessary types definitions to use: pnpm install --save @types/react-swipeable-views-utils @types/react-swipeable-views, same for pnpm i -D @types/google.maps. Also I have to add this packages to noExternal config in my vite.config.ts file because each of them was throw me with error.

// https://vitejs.dev/config/ssr-options.html#ssr-noexternal
const isProd = process.env.NODE_ENV === 'production'
const noExternal: string[] = []
if (isProd) {
    noExternal.push(
        ...[
            // MUI needs to be pre-processed by Vite in production: https:/brillout/vite-plugin-ssr/discussions/901
            …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@brillout
Comment options

Answer selected by Maikpwwq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants