Import Preact from @uppy/utils to guarantee a single version#6206
Import Preact from @uppy/utils to guarantee a single version#6206
Conversation
🦋 Changeset detectedLatest commit: e353bd4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
mifi
left a comment
There was a problem hiding this comment.
a bit unusual approach imo but we can try and see if it works on the next release, worst case we just revert it
qxprakash
left a comment
There was a problem hiding this comment.
This is a pragmatic approach for us ! , btw no changeset ?
There was a problem hiding this comment.
Pull request overview
This PR addresses the Preact multi-version/runtime mismatch that can occur when Uppy packages and the consuming app end up resolving different preact instances, by centralizing Preact imports through @uppy/utils and removing direct preact dependencies from many packages.
Changes:
- Add
@uppy/utils/preactand@uppy/utils/preact/hooksentrypoints (re-exporting frompreact). - Update TS/TSX/Svelte/Vue/React wrappers across packages to import Preact APIs via
@uppy/utils/preact*instead ofpreact*. - Remove
preactfrom many packagedependenciesand update the lockfile accordingly.
Reviewed changes
Copilot reviewed 96 out of 115 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Removes many workspace-level preact deps and adds @uppy/utils where needed to reflect new import strategy. |
| packages/@uppy/zoom/src/Zoom.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/zoom/package.json | Drops direct preact dependency. |
| packages/@uppy/webdav/src/Webdav.tsx | Switches Preact + hooks imports to @uppy/utils/preact*. |
| packages/@uppy/webdav/package.json | Drops direct preact dependency. |
| packages/@uppy/webcam/src/Webcam.tsx | Switches Preact import to @uppy/utils/preact (plus minor import reordering). |
| packages/@uppy/webcam/src/VideoSourceSelect.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/webcam/src/PermissionsScreen.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/webcam/src/CameraScreen.tsx | Switches Preact component/types import to @uppy/utils/preact. |
| packages/@uppy/webcam/src/CameraIcon.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/webcam/package.json | Drops direct preact dependency. |
| packages/@uppy/vue/src/headless/generated/UploadButton.ts | Switches Preact imports to @uppy/utils/preact in Vue wrapper. |
| packages/@uppy/vue/src/headless/generated/Thumbnail.ts | Switches Preact imports to @uppy/utils/preact in Vue wrapper. |
| packages/@uppy/vue/src/headless/generated/ProviderIcon.ts | Switches Preact imports to @uppy/utils/preact in Vue wrapper. |
| packages/@uppy/vue/src/headless/generated/FilesList.ts | Switches Preact imports to @uppy/utils/preact in Vue wrapper. |
| packages/@uppy/vue/src/headless/generated/FilesGrid.ts | Switches Preact imports to @uppy/utils/preact in Vue wrapper. |
| packages/@uppy/vue/src/headless/generated/Dropzone.ts | Switches Preact imports to @uppy/utils/preact in Vue wrapper. |
| packages/@uppy/vue/package.json | Replaces preact dependency with @uppy/utils. |
| packages/@uppy/utils/src/preact/index.ts | Adds @uppy/utils/preact re-export entrypoint. |
| packages/@uppy/utils/src/preact/hooks.ts | Adds @uppy/utils/preact/hooks re-export entrypoint. |
| packages/@uppy/utils/package.json | Exposes new export subpaths for the Preact re-exports. |
| packages/@uppy/url/src/UrlUI.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/url/src/Url.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/url/package.json | Drops direct preact dependency. |
| packages/@uppy/unsplash/src/Unsplash.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/unsplash/package.json | Drops direct preact dependency. |
| packages/@uppy/svelte/src/lib/components/headless/generated/UploadButton.svelte | Switches Preact imports to @uppy/utils/preact in Svelte wrapper. |
| packages/@uppy/svelte/src/lib/components/headless/generated/Thumbnail.svelte | Switches Preact imports to @uppy/utils/preact in Svelte wrapper. |
| packages/@uppy/svelte/src/lib/components/headless/generated/ProviderIcon.svelte | Switches Preact imports to @uppy/utils/preact in Svelte wrapper. |
| packages/@uppy/svelte/src/lib/components/headless/generated/FilesList.svelte | Switches Preact imports to @uppy/utils/preact in Svelte wrapper. |
| packages/@uppy/svelte/src/lib/components/headless/generated/FilesGrid.svelte | Switches Preact imports to @uppy/utils/preact in Svelte wrapper. |
| packages/@uppy/svelte/src/lib/components/headless/generated/Dropzone.svelte | Switches Preact imports to @uppy/utils/preact in Svelte wrapper. |
| packages/@uppy/svelte/package.json | Replaces preact dependency with @uppy/utils. |
| packages/@uppy/status-bar/src/StatusBar.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/status-bar/package.json | Drops direct preact dependency. |
| packages/@uppy/screen-capture/src/SubmitButton.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/screen-capture/src/StopWatch.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/screen-capture/src/ScreenCapture.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/screen-capture/src/RecorderScreen.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/screen-capture/src/RecordButton.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/screen-capture/src/DiscardButton.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/screen-capture/package.json | Drops direct preact dependency. |
| packages/@uppy/react/src/headless/generated/UploadButton.tsx | Switches Preact imports to @uppy/utils/preact in React wrapper. |
| packages/@uppy/react/src/headless/generated/Thumbnail.tsx | Switches Preact imports to @uppy/utils/preact in React wrapper. |
| packages/@uppy/react/src/headless/generated/ProviderIcon.tsx | Switches Preact imports to @uppy/utils/preact in React wrapper. |
| packages/@uppy/react/src/headless/generated/FilesList.tsx | Switches Preact imports to @uppy/utils/preact in React wrapper. |
| packages/@uppy/react/src/headless/generated/FilesGrid.tsx | Switches Preact imports to @uppy/utils/preact in React wrapper. |
| packages/@uppy/react/src/headless/generated/Dropzone.tsx | Switches Preact imports to @uppy/utils/preact in React wrapper. |
| packages/@uppy/react/package.json | Replaces preact dependency with @uppy/utils. |
| packages/@uppy/provider-views/src/useSearchForm.ts | Switches Preact hooks imports to @uppy/utils/preact/hooks. |
| packages/@uppy/provider-views/src/SearchView.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/SearchProviderView/SearchProviderView.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/ProviderView/User.tsx | Switches Fragment import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/ProviderView/ProviderView.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/ProviderView/Header.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/ProviderView/AuthView.tsx | Switches Preact + hooks imports to @uppy/utils/preact*. |
| packages/@uppy/provider-views/src/Item/index.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/Item/components/ListItem.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/Item/components/ItemIcon.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/Item/components/GridItem.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/provider-views/src/GooglePicker/googlePicker.ts | Switches Preact hook type import to @uppy/utils/preact/hooks. |
| packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx | Switches Preact hooks imports to @uppy/utils/preact/hooks. |
| packages/@uppy/provider-views/src/FooterActions.tsx | Switches useMemo import to @uppy/utils/preact/hooks. |
| packages/@uppy/provider-views/src/Browser.tsx | Switches Preact hooks imports to @uppy/utils/preact/hooks. |
| packages/@uppy/provider-views/src/Breadcrumbs.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/provider-views/package.json | Drops direct preact dependency. |
| packages/@uppy/onedrive/src/OneDrive.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/onedrive/package.json | Drops direct preact dependency. |
| packages/@uppy/instagram/src/Instagram.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/instagram/package.json | Drops direct preact dependency. |
| packages/@uppy/image-generator/src/index.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/image-generator/package.json | Drops direct preact dependency. |
| packages/@uppy/image-editor/src/Editor.tsx | Switches Component import to @uppy/utils/preact. |
| packages/@uppy/image-editor/package.json | Drops direct preact dependency. |
| packages/@uppy/google-photos-picker/package.json | Drops direct preact dependency. |
| packages/@uppy/google-drive/src/GoogleDrive.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/google-drive/package.json | Drops direct preact dependency. |
| packages/@uppy/google-drive-picker/package.json | Drops direct preact dependency. |
| packages/@uppy/facebook/src/Facebook.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/facebook/package.json | Drops direct preact dependency. |
| packages/@uppy/dropbox/src/Dropbox.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/dropbox/package.json | Drops direct preact dependency. |
| packages/@uppy/drag-drop/src/DragDrop.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/drag-drop/package.json | Drops direct preact dependency. |
| packages/@uppy/dashboard/src/components/StatusBar/StatusBar.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/Slide.tsx | Switches Preact + hooks imports to @uppy/utils/preact*. |
| packages/@uppy/dashboard/src/components/PickerPanelContent.tsx | Switches Preact hook import to @uppy/utils/preact/hooks. |
| packages/@uppy/dashboard/src/components/Informer/TransitionGroup.ts | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/Informer/Informer.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/Informer/FadeIn.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/FileList.tsx | Switches Preact hook import to @uppy/utils/preact/hooks. |
| packages/@uppy/dashboard/src/components/FileItem/index.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/FileItem/FileProgress/index.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/FileCard/index.tsx | Switches Preact hooks imports to @uppy/utils/preact/hooks. |
| packages/@uppy/dashboard/src/components/FileCard/RenderMetaFields.tsx | Switches h import to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/Dashboard.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/components/AddFiles.tsx | Switches Preact imports to @uppy/utils/preact. |
| packages/@uppy/dashboard/src/Dashboard.tsx | Switches Preact type imports to @uppy/utils/preact. |
| packages/@uppy/dashboard/package.json | Drops direct preact dependency. |
| packages/@uppy/core/src/Uppy.ts | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/core/src/UIPlugin.ts | Switches render import to @uppy/utils/preact. |
| packages/@uppy/core/package.json | Drops direct preact dependency. |
| packages/@uppy/compressor/package.json | Drops direct preact dependency. |
| packages/@uppy/components/src/Thumbnail.tsx | Switches Preact hooks imports to @uppy/utils/preact/hooks. |
| packages/@uppy/components/src/FilesList.tsx | Switches Preact + hooks imports to @uppy/utils/preact*. |
| packages/@uppy/components/src/FilesGrid.tsx | Switches Preact + hooks imports to @uppy/utils/preact*. |
| packages/@uppy/components/src/Dropzone.tsx | Switches Preact hook import to @uppy/utils/preact/hooks. |
| packages/@uppy/components/package.json | Adds @uppy/utils dependency and drops direct preact dependency. |
| packages/@uppy/components/migrate.mjs | Updates migration templates to import Preact via @uppy/utils/preact. |
| packages/@uppy/box/src/Box.tsx | Switches Preact import to @uppy/utils/preact. |
| packages/@uppy/box/package.json | Drops direct preact dependency. |
| packages/@uppy/audio/src/RecordingScreen.tsx | Switches Preact hooks imports to @uppy/utils/preact/hooks. |
| packages/@uppy/audio/src/PermissionsScreen.tsx | Switches Preact type import to @uppy/utils/preact. |
| packages/@uppy/audio/package.json | Drops direct preact dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -51,7 +51,6 @@ | |||
| "classnames": "^2.2.6", | |||
| "lodash": "^4.17.23", | |||
| "nanoid": "^5.0.9", | |||
| "exports": { | ||
| ".": "./lib/index.js", | ||
| "./preact": "./lib/preact/index.js", | ||
| "./preact/hooks": "./lib/preact/hooks.js", | ||
| "./package.json": "./package.json" |
| "exports": { | ||
| ".": "./lib/index.js", | ||
| "./preact": "./lib/preact/index.js", | ||
| "./preact/hooks": "./lib/preact/hooks.js", | ||
| "./package.json": "./package.json" |
fixes #6173
closes #6202