Uncaught TypeError: (0 , o.default) is not a function: What's causing it?

Viewed 27658

In my create react app project I'm running into the following error in my production build (not in my dev build):

Uncaught TypeError: (0 , o.default) is not a function at Object.e.f.(:4444/anonymous function)...

I've been investigating this bug for a couple of hours but struggle to find out how to debug this uglified piece of js.

What makes it tough is that the error returns o.default and not SomeLibrary.default so I don't really know where to start my search really...

What does that o.default mean in this case? Any tips for figuring out what's going wrong here?

3 Answers

It seems to be import statement somewhere in your file is incorrect.

Example: (from an issue)

// fails
import combineReducers from "redux"

// correct
import { combineReducers } from "redux"

What makes it tough is that the error returns o.default and not SomeLibrary.default so I don't really know where to start my search really...

There's nothing but exported in some library just as o. Example default export:

export default {
  o: something
}

For those who tried the solution above and still cannot solve this problem, you might be importing the library successfully and then using the library in a function that is located in the same file.

But, if you export that file and import it to another file, that is where you might be having a problem.

Simply import your already exported file as -

import {myComponent} from "/util/http"

instead of -

import myComponent from "/util/http"

Hope that helps.

If this is happening for anyone with Auth.signIn using aws-amplify, please try the below update for aws-amplify. This worked as a permanent fix and didn't break any of my current code.

sudo npx npm-check-updates -i '/@?aws-amplify/' && npm update --force
Related