TypeError: countdown__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function
CalvinJamesHeath opened this issue · 1 comments
CalvinJamesHeath commented
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 commented
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