'react-scripts-ts results in corrupted build

I am working on this legacy application. It is using react-scripts-ts for running it. So the scripts section of package.json looks like this:

  "scripts": {
    "start": "react-scripts-ts start",
    "build": "react-scripts-ts build"
  },

I was cleaning some dependencies as they caused us an issue, but I am unable to get the application to work now.

If I do npm start all is good and works well.

If I do npm run buil all compiles ok no errors. However, if I try to use the application from the built artifacts I get:

Uncaught (in promise) TypeError: Super expression must either be null or a function
    at 6.fb2d1b96.chunk.js:1:99050
    at 6.fb2d1b96.chunk.js:1:99118
    at Object.e.exports (6.fb2d1b96.chunk.js:1:100445)
    ...

Would you have any pointers or tips on how to debug this?



Solution 1:[1]

Check your code:
If you have React.component and replace it with React.Component.

That is what i can think of from first glance, otherwise you can provide us with code sample.

Edit: Another thing may be the imports, check them as well.

Ref:
https://medium.com/@anuhosad/react-errors-super-expression-must-either-be-null-or-a-function-4aac6e5173ad

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dobromir Kirov