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

SSR ERR_MODULE_NOT_FOUND #136

Open nirtamir2 opened 1 month ago

nirtamir2 commented 1 month ago

I got this error when I tried to import @atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge and it was in my deps

    "@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
    "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",

I'm using solidstart with ssr: true

Temporary workaround is to load this component in the client using clientOnly

Unhandled Rejection: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/node_modules/@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge' imported from /var/task/chunks/build/index2.mjs
    at finalizeResolution (node:internal/modules/esm/resolve:269:11)
    at moduleResolve (node:internal/modules/esm/resolve:937:10)
    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1173:14)
    at defaultResolve (node:internal/modules/esm/resolve:1216:79)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:540:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:509:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
    at link (node:internal/modules/esm/module_job:95:36) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///var/task/node_modules/@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge'
}
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.