xnimorz/use-debounce

Cannot find module 'use-debounce'

Closed this issue · 6 comments

Describe the bug
With the just-released 9.0.0, can't import anything from this library.

To Reproduce

import { useThrottledCallback } from 'use-debounce';

The problem only manifests itself when I'm using Jest.

I believe this is a problem with exports in package.json:

  "exports": {
    ".": {
      "node": {
        "types": "./dist/index.d.ts",
        "module": "./dist/index.module.js",
        "require": "./dist/index.js",
        "import": "./dist/index.mjs"
      },
      "browser": {
        "types": "./dist/index.d.ts",
        "import": "./dist/index.module.js",
        "require": "./dist/index.js"
      },
      "default": "./dist/index.module.js"
    },
    "./package.json": "./package.json"
  },

But the files included are:

% ls node_modules/use-debounce/dist/
index.cjs                  index.modern.js            index.umd.js               useThrottledCallback.d.ts
index.cjs.map              index.modern.js.map        index.umd.js.map
index.d.ts                 index.module.js            useDebounce.d.ts
index.mjs                  index.module.js.map        useDebouncedCallback.d.ts

The module for "require" is not there.

Hey @denchen !

Sorry for the inconvenience. I've just published v9.0.1 it should fix the issue

Hi @xnimorz ,

So the import problem is fixed, but now I'm getting a new error, again within Jest:

  ● App › should have error state

    TypeError: (0 , _useDebounce.useThrottledCallback) is not a function

      45 |
    > 46 |   const throttledScroll = useThrottledCallback(
         |                                               ^

My actual app works just fine with useThrottledCallback(). It's just failing within the tests.

Hey @xnimorz, thanks for the quick fix for the v9.0.1, but it seems it has not resolved the issue of importing the useDebounce as below:

image

It works fine for the v8.0.4, but not the latest major version.

image

Would you mind checking it or advising me, please? Thank you!

Hey @malfianrasyidin
I’ll take care of it later today.

I’d advise using 8.0.4 for now.

Okay, So I've reverted recent 9.0.0 changes, and it should be back to normal.

Thanks @xnimorz . I've verified that everything is working again, both app and tests, at least in my setup.