diff --git a/common/changes/@itwin/appui-react/mast-lodash-import-fix_2025-01-17-12-23.json b/common/changes/@itwin/appui-react/mast-lodash-import-fix_2025-01-17-12-23.json new file mode 100644 index 00000000000..335bbf37e49 --- /dev/null +++ b/common/changes/@itwin/appui-react/mast-lodash-import-fix_2025-01-17-12-23.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/appui-react", + "comment": "Fixed `module 'lodash' does not provide an export named...` error when running in Node.js.", + "type": "none" + } + ], + "packageName": "@itwin/appui-react" +} diff --git a/common/changes/@itwin/components-react/mast-lodash-import-fix_2025-01-17-12-23.json b/common/changes/@itwin/components-react/mast-lodash-import-fix_2025-01-17-12-23.json new file mode 100644 index 00000000000..5cc99ec00a0 --- /dev/null +++ b/common/changes/@itwin/components-react/mast-lodash-import-fix_2025-01-17-12-23.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/components-react", + "comment": "Fixed `module 'lodash' does not provide an export named...` error when running in Node.js.", + "type": "none" + } + ], + "packageName": "@itwin/components-react" +} diff --git a/common/changes/@itwin/core-react/mast-lodash-import-fix_2025-01-17-12-23.json b/common/changes/@itwin/core-react/mast-lodash-import-fix_2025-01-17-12-23.json new file mode 100644 index 00000000000..4f922fbaef0 --- /dev/null +++ b/common/changes/@itwin/core-react/mast-lodash-import-fix_2025-01-17-12-23.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/core-react", + "comment": "Fixed `module 'lodash' does not provide an export named...` error when running in Node.js.", + "type": "none" + } + ], + "packageName": "@itwin/core-react" +} diff --git a/ui/appui-react/src/appui-react/layout/base/DragManager.tsx b/ui/appui-react/src/appui-react/layout/base/DragManager.tsx index 90f0aadc3e9..fd80ba7318b 100644 --- a/ui/appui-react/src/appui-react/layout/base/DragManager.tsx +++ b/ui/appui-react/src/appui-react/layout/base/DragManager.tsx @@ -6,7 +6,7 @@ * @module Base */ import * as React from "react"; -import { isEqual } from "lodash"; +import isEqual from "lodash/isEqual.js"; import { BeEvent } from "@itwin/core-bentley"; import { Point } from "@itwin/core-react/internal"; import type { PanelSide } from "../widget-panels/PanelTypes.js"; diff --git a/ui/appui-react/src/appui-react/messages/MessageManager.tsx b/ui/appui-react/src/appui-react/messages/MessageManager.tsx index 198cec63e36..8b8ead87198 100644 --- a/ui/appui-react/src/appui-react/messages/MessageManager.tsx +++ b/ui/appui-react/src/appui-react/messages/MessageManager.tsx @@ -7,7 +7,7 @@ */ import classnames from "classnames"; -import { isEqual } from "lodash"; +import isEqual from "lodash/isEqual.js"; import * as React from "react"; import type { XAndY } from "@itwin/core-geometry"; import type { diff --git a/ui/appui-react/src/appui-react/pickers/ViewSelector.tsx b/ui/appui-react/src/appui-react/pickers/ViewSelector.tsx index de42ebff401..e5d76515bdc 100644 --- a/ui/appui-react/src/appui-react/pickers/ViewSelector.tsx +++ b/ui/appui-react/src/appui-react/pickers/ViewSelector.tsx @@ -17,7 +17,7 @@ import { UiFramework } from "../UiFramework.js"; import { ViewUtilities } from "../utils/ViewUtilities.js"; import type { ListItem } from "./ListPicker.js"; import { ListItemType, ListPicker } from "./ListPicker.js"; -import { debounce } from "lodash"; +import debounce from "lodash/debounce.js"; import { SvgSavedView } from "../icons/SvgSavedView.js"; import { useReduxFrameworkState } from "../uistate/useReduxFrameworkState.js"; import type { ListenerType } from "@itwin/core-react/internal"; diff --git a/ui/appui-react/src/appui-react/widget-panels/useSaveFrontstageSettings.tsx b/ui/appui-react/src/appui-react/widget-panels/useSaveFrontstageSettings.tsx index f9903addd7f..3577ddf4b21 100644 --- a/ui/appui-react/src/appui-react/widget-panels/useSaveFrontstageSettings.tsx +++ b/ui/appui-react/src/appui-react/widget-panels/useSaveFrontstageSettings.tsx @@ -18,8 +18,7 @@ import { packNineZoneState, stateVersion, } from "./Frontstage.js"; -import type { DebouncedFunc } from "lodash"; -import { debounce } from "lodash"; +import debounce from "lodash/debounce.js"; type SaveSettingFn = ( frontstage: FrontstageDef, @@ -32,9 +31,9 @@ export function useSaveFrontstageSettings( store: LayoutStore ) { const uiSettingsStorage = useUiStateStorageHandler(); - const saveSettingRef = React.useRef | undefined>( - undefined - ); + const saveSettingRef = React.useRef< + ReturnType> | undefined + >(undefined); const save = React.useCallback(async (frontstage, state) => { if (!saveSettingRef.current) return; if (state.draggedTab) return; diff --git a/ui/components-react/src/components-react/tree/controlled/TreeModel.ts b/ui/components-react/src/components-react/tree/controlled/TreeModel.ts index e930406b25d..8f0fe8d73fa 100644 --- a/ui/components-react/src/components-react/tree/controlled/TreeModel.ts +++ b/ui/components-react/src/components-react/tree/controlled/TreeModel.ts @@ -7,7 +7,7 @@ */ import { immerable } from "immer"; -import { cloneDeep } from "lodash"; +import cloneDeep from "lodash/cloneDeep.js"; import { assert } from "@itwin/core-bentley"; import type { PropertyRecord } from "@itwin/appui-abstract"; import type { diff --git a/ui/core-react/src/core-react/utils/hooks/useThrottledFn.tsx b/ui/core-react/src/core-react/utils/hooks/useThrottledFn.tsx index 1fb5827aec2..1bbc41c8679 100644 --- a/ui/core-react/src/core-react/utils/hooks/useThrottledFn.tsx +++ b/ui/core-react/src/core-react/utils/hooks/useThrottledFn.tsx @@ -7,7 +7,7 @@ */ import * as React from "react"; -import { throttle } from "lodash"; +import throttle from "lodash/throttle.js"; /** lodash throttle options * @internal