Open kacpak opened 1 month ago
cc @ReDrUm
👋 Thank you for raising this.
exports
to all packages soonpatch-package
, which is awesomeStandalone vite demo on Stackblitz
vite/5.2.8 linux-x64 node-v18.18.0
For me the issue was that when my IDE (WebStorm) added the import automatically it got imported as:
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
while the correct import should be:
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
It might still require the same fix however it took me an embarrassing long time to realize the import path was wrong.
To add some further examples where VSCode by default imported from incorrect paths:
import { Instruction, ItemMode } from '@atlaskit/pragmatic-drag-and-drop-hitbox/dist/types/tree-item';
import { draggable, dropTargetForElements, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/dist/types/adapter/element-adapter';
import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/dist/types/entry-point/element/pointer-outside-of-preview';
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/dist/types/entry-point/element/set-custom-native-drag-preview';
import { combine } from '@atlaskit/pragmatic-drag-and-drop/dist/types/public-utils/combine';
Should instead be:
import { Instruction, ItemMode } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
import { draggable, dropTargetForElements, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview';
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
Hi,
I wanted to play around with the library, so I created a fresh Vite project
npm create vite
with React & TypeScript and started with such importUnfortunately it was not resolved. I dug into the package.json and from what I saw only the main entry points are exposed (which contain nothing, since as per documentation we should import individual files). Adding proper "exports" field to package.json with all files in dist/(esm|cjs|types) fixed the issue for me, but I'm now relying on patch-package lib and a git diff to keep it working. This is the diff I applied: @atlaskit+pragmatic-drag-and-drop+1.1.3.patch and a preview of the file: