Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: countdown__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function #42

Open
CalvinJamesHeath opened this issue Mar 27, 2023 · 1 comment

Comments

@CalvinJamesHeath
Copy link

When I attempt to import countdown

import countdown from 'countdown';

I get the following error

Uncaught TypeError: countdown__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function
    at TimerCountdown (main.42dec686241258517455.hot-update.js:58:80)
    at renderWithHooks (react-dom.development.js:14985:1)
    at mountIndeterminateComponent (react-dom.development.js:17811:1)
    at beginWork (react-dom.development.js:19049:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
    at invokeGuardedCallback (react-dom.development.js:4056:1)
    at beginWork$1 (react-dom.development.js:23964:1)
    at performUnitOfWork (react-dom.development.js:22776:1)
    at workLoopSync (react-dom.development.js:22707:1)

And when I console log countdown I get an object instead of a function.
console.log(countdown) => returs {}
hence the countdown is not a function error...

@CalvinJamesHeath
Copy link
Author

Webpack versions 5 or above (5.76.3) adopted the newer Node semantics regarding esm, so it expects either a full path with file extension, or 'countdown' to be matched in an exports map. The error goes away If I downgrade react scripts prior to v5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant