redux-saga / saga-query

Data synchronization using a middleware system for front-end apps
64 stars 4 forks source link

import from saga-query/react #19

Closed VldMrgnn closed 1 year ago

VldMrgnn commented 1 year ago

In version 5.0.3, the following import statement is no longer valid

import { useLoader } from 'saga-query/react';
neurosnap commented 1 year ago

Yea I've been wrestling with esm and cjs issues. Are you using typescript? I had to set moduleresolution to nodenext

VldMrgnn commented 1 year ago

Please see the tsconfig.json below:

{
  "compilerOptions": {
    "target": "es5",
    "downlevelIteration": true,
    "lib": [
      "dom",
      "dom.iterable",
      "esnext",
      "es5",
      "es2015.collection",
      "es2015.iterable"
    ],
    "baseUrl": ".",
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react",
    "paths": {
      "@app/*": ["src/*"]
    },
  },
  "include": ["src", "index.d.ts", "custom.d.ts" ,"webpack.config.js"]
}
neurosnap commented 1 year ago

Can you try setting moduleResolution: "nodenext"

VldMrgnn commented 1 year ago

Setting moduleResolution: "nodenext" fixes the issue, but in my case breaks some lazy imports and other CommonJs imports.

neurosnap commented 1 year ago

Okay, if you could downgrade to 4.x for now I'll push another fix shortly.

VldMrgnn commented 1 year ago

Of course. Please tell me if I can assist for testing or help otherwise.

neurosnap commented 1 year ago

I ended up reverting the build system and pushed a release. There's too many issues with ESM at this point.

VldMrgnn commented 1 year ago

I can confirm that 5.0.8. works as expected.