atlassian / pragmatic-drag-and-drop

Fast drag and drop for any experience on any tech stack
https://atlassian.design/components/pragmatic-drag-and-drop
Other
9.11k stars 199 forks source link

Pragma cannot be set when runtime is automatic (Nextjs) #85

Open danieldelcore opened 2 months ago

danieldelcore commented 2 months ago
image
Error: 
  × pragma cannot be set when runtime is automatic
   ╭─[/Users/foo/Development/bar/node_modules/@atlaskit/pragmatic-drag-and-drop-react-accessibility/dist/esm/drag-handle-button-base.js:1:1]
 1 │ import _extends from "@babel/runtime/helpers/extends";
 2 │ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
 3 │ var _excluded = ["children", "isSelected", "testId", "appearance", "type"];
 4 │ /** @jsx jsx */
   · ───────────────
 5 │ 
 6 │ import { forwardRef } from 'react';
   ╰────

Env:

benjosua commented 1 month ago

I would try to help but im not able to reproduce this, could you provide a link to a public GitHub repository or a CodeSandbox with a minimal reproduction?

username14415 commented 1 month ago

duplicate https://github.com/atlassian/pragmatic-drag-and-drop/issues/67 atlassian hasn't fixed it for years, this topic is from 2022: https://community.developer.atlassian.com/t/unable-to-consume-atlaskit-in-react-18/58519

alexreardon commented 1 month ago

@danieldelcore could this be something to do with emotion? I think that component is using emotion 🤔

danieldelcore commented 1 month ago

Yeah emotion was my first guess, I'm using a newer version of react via nextjs, so I'm probably running into emotion's compatibility issues with modern react. 🤔

alexreardon commented 1 month ago

Maybe your quickest option is to copy base the drag handle button and use your own styling approach

alexreardon commented 1 month ago

Let me know how you go

lucarampi commented 3 days ago

As far as I researched, it's an Emotion-related issue. I had the same problem and I'm not entirely sure how I solved it, but my guess is that adding "use client" might have done the trick.

You can take a look here if it helps.