Экспортный тост не существует в целевом модуле - используя Heroui/ToastJavascript

Форум по Javascript
Ответить
Anonymous
 Экспортный тост не существует в целевом модуле - используя Heroui/Toast

Сообщение Anonymous »

фон:
Я пытаюсь добавить уведомления об поджарении в мое приложение NextJs . Я следил за официальной документацией здесь: https://www.heroui.com/docs/components/toast

Код: Выделить всё

providers.jsx
:

Код: Выделить всё

import {NextUIProvider} from '@nextui-org/react'
import {useRouter} from "next/navigation";
import {ThemeProvider as NextThemesProvider} from "next-themes";
import {HeroUIProvider} from "@heroui/react";
import {ToastProvider} from "@heroui/toast";

export function Providers({children}) {

const router = useRouter()

return (




{children}



)
}
< /code>
layout.js
:

Код: Выделить всё

export default function RootLayout({children}) {
return (



Hydra Server




{children}




);
}
< /code>
Example of adding a Toast:
import {addToast} from "@heroui/toast";

...

function onError(error) {
addToast({
title: "Error",
description: error.statusText
});
setIsLoading(false)
}
< /code>
[b]The problem:[/b]
When the page is compiled (I'm currently using npm run dev
для тестирования), я получаю следующие ошибки:
⨯ ./node_modules/@heroui/toast/dist/chunk-A3E4DQTR.mjs:5:1
Export toast doesn't exist in target module
3 | // src/use-toast.ts
4 | import { mapPropsVariants, useProviderContext } from "@heroui/system";
> 5 | import { toast as toastTheme } from "@heroui/theme";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 | import { useDOMRef } from "@heroui/react-utils";
7 | import { clsx, dataAttr, isEmpty, objectToDeps } from "@heroui/shared-utils";
8 | import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";

The export toast was not found in module [project]/node_modules/@heroui/theme/dist/index.mjs [app-client] (ecmascript) .
Did you mean to import tabs?
All exports of the module are statically known (It doesn't have dynamic exports). So it's known statically that the requested export doesn't exist.

./node_modules/@heroui/toast/dist/chunk-RJHHOZ5N.mjs:11:1
Export toastRegion doesn't exist in target module
9 | import { useHover } from "@react-aria/interactions";
10 | import { mergeProps } from "@react-aria/utils";
> 11 | import { toastRegion } from "@heroui/theme";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 | import { jsx } from "react/jsx-runtime";
13 | function ToastRegion({
14 | toastQueue,

The export toastRegion was not found in module [project]/node_modules/@heroui/theme/dist/index.mjs [app-client] (ecmascript) .
Did you mean to import listboxSection?
All exports of the module are statically known (It doesn't have dynamic exports). So it's known statically that the requested export doesn't exist.

< /code>
Is this a bug or a problem with my setup?


Подробнее здесь: https://stackoverflow.com/questions/794 ... roui-toast
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Javascript»