xnimorz/use-debounce

5.0.3 — useDebouncedCallback export issue

Closed this issue · 7 comments

Hey, firstly thank you for your work on the package, appreciate it.

There is an issue in the latest version 5.0.3, it seems like useDebouncedCallback hasn't been exported properly

ModuleNotFoundError: Module not found: Error: Package path ./lib/useDebouncedCallback is not exported from package /node_modules/use-debounce (see exports field in /node_modules/use-debounce/package.json)

Hi @kamranahmedse !
Could you provide your import line with useDebounce, please?

It is as per the docs

import { useDebouncedCallback } from 'use-debounce';

I've tried to reproduce the problem, but it worked.

Could you provide a small example of the described problem?

Ah, my bad, one of the "hidden" imports in the project was wrong.

- import useDebouncedCallback from 'use-debounce/lib/useDebouncedCallback';
+ import { useDebouncedCallback } from 'use-debounce';

Apologies for the hassle. Thank you Nik! :)

I have this issue with the latest use-debounce and only one import like:

import { useDebouncedCallback } from 'use-debounce';
Module not found: Error: Package path . is not exported from package /home/bertho/dev/oa/node_modules/use-debounce (see exports field in /home/bertho/dev/oa/node_modules/use-debounce/package.json)

I found right after writing the comment, if you modify conditionNames in your webpack config, consider adding ...:

- conditionNames: ['oa']
+ conditionNames: ['oa', '...']

was banging my head against a wall for days on this
thanks!