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.77k stars 223 forks source link

SvelteKit support #107

Open macmillen opened 3 months ago

macmillen commented 3 months ago

Currently when trying to build and preview a SvelteKit project using this library we get this error:

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/home/projects/stackblitz-starters-zysvzp/node_modules/@atlaskit/pragmatic-drag-and-drop/element/adapter' is not supported resolving ES modules imported from /home/projects/stackblitz-starters-zysvzp/.svelte-kit/output/server/entries/pages/_page.svelte.js
Did you mean to import @atlaskit/pragmatic-drag-and-drop/dist/cjs/entry-point/element/adapter.js?
    at __node_internal_captureLargerStackTrace2 (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:101:5335)
    at new NodeError (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:101:4149)
    at finalizeResolution (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:10852)
    at moduleResolve (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:11119)
    at defaultResolve (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:12372)
    at ModuleLoader.defaultResolve (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:3284)
    at ModuleLoader.resolve (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:2989)
    at ModuleLoader.getModuleJob (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:1938)
    at https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:155:1047
    at _0x48ff51.link (https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/blitz.6352fbed.js:40:787732)
    at https://stackblitzstarterszysvzp-1gsx.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:155:1002 {
  url: 'file:///home/projects/stackblitz-starters-zysvzp/node_modules/@atlaskit/pragmatic-drag-and-drop/element/adapter',
  code: 'ERR_UNSUPPORTED_DIR_IMPORT'
}

demo: It works in only in dev. Try npm run build & npm run preview and it will fail. https://stackblitz.com/edit/stackblitz-starters-zysvzp

macmillen commented 2 months ago

Apparently it's not SvelteKit specific and it's happening during SSR. https://github.com/atlassian/pragmatic-drag-and-drop/issues/27#issuecomment-2322813841