Topic: 'initTWE' import error after updating 'tw-elements' to version 2.0.0"
Brzyski premium asked 7 months ago
Expected behavior
After updating to tw-elements v2.0.0, it was expected that all functions and methods would work correctly after renaming according to the migration documentation.
Actual behavior
After updating to tw-elements v2.0.0 and attempting to import initTWE from tw-elements, an error occurs: export 'initTWE' (imported as 'initTWE') was not found in 'tw-elements'.
Resources (screenshots, code snippets etc.)
import {
Toast,
initTWE,
} from "tw-elements";
The error that is displayed:
ERROR in ./src/pages/flow/specialStages/rpwdl/index.tsx 237:4-11
export 'initTWE' (imported as 'initTWE') was not found in 'tw-elements' (possible exports: Alert, Animate, Button, Carousel, Chart, Chip, ChipsInput, Clipboard, Collapse, Datatable, Datepicker, Datetimepicker, Dropdown, InfiniteScroll, Input, LazyLoad, Lightbox, LoadingManagement, Modal, Offcanvas, PerfectScrollbar, Popconfirm, Popover, Rating, Ripple, ScrollSpy, Select, Sidenav, SmoothScroll, Stepper, Sticky,
Tab, Timepicker, Toast, Tooltip, Touch, Validation, initTE)
Jianwen Tan premium answered 1 month ago
For anyone encountered this issue:
After we upgraded TWE to 2.0.0 or above, 'Toast' is now a component that belongs to pro-version only, so it's not going to be used in the version that install by npm install/yarn add.
Igor Przybysz staff answered 7 months ago
Hi, I've created Vite App and installed tw elements pro following this guide and I can't reproduce this issue. Everything works fine for me.
I have few questions that will help us to figure out whats going on:
How did you update TWE in your project? Did you experience any other issues, for example with data attributes?
Have you followed all instructions from Migration Guide?
It is worth checking the version of TWE in
node_modules
or package-lock.json
. You can try also deleting node_modules
and installing it again.
FYI: We have TWE Elements section in support. There we will find this issue quicker and react to it.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Premium
- Premium support: Yes
- Technology: MDB React
- MDB Version: MDB5 7.2.0
- Device: ThinkPad L14
- Browser: Chrome DEV
- OS: Windows 10
- Provided sample code: No
- Provided link: No