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

Webpack minification causes "Super expression must either be null or a function" error in prod #70

Open
dimapx opened this issue Oct 23, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@dimapx
Copy link

dimapx commented Oct 23, 2019

Hey @pierpo,

We've deployed to our staging environment code that uses react-archer for the first time and are experiencing the following (breaking) error:

Uncaught TypeError: Super expression must either be null or a function
    at 3.eaf63c57.chunk.js:412
    ...
    ...

(the error is not present while working locally)

After extensive investigation, we were able to narrow down the issue to webpack minification, i.e. the error no longer appears (and the web app runs properly) when we add minimize: false under optimization (in webpack.config.js).

We don't want to disable minification globally, so now we are trying to disable it only on the code that uses react-archer.

Are you familiar with this minification issue? Relevant solutions?

We're using react 16.9.0 with webpack 4.3.2.

Thanks,
Dima.

@jfo84
Copy link
Contributor

jfo84 commented Oct 23, 2019

Hey @dimapx, I ran into the same issue when I worked on this library some time ago. Some part of a solution can be found in #24.

If you feel like debugging Uglify/Terser and why ECMAScript JS does not spit out equivalent JS, then go for it. However, the libraries are in fact very poor architecturally, the bundle size gains are minimal, and the community is hostile. Optimizing function calls at runtime is something that the engines do much better than we ever could in user space, so I highly recommend disabling function inlining and moving on with your life.

Cheers,
Jack

@pierpo
Copy link
Owner

pierpo commented Oct 24, 2019

@jfo84 Thank you for answering the issue!

What if we got rid of the switch statements of the project. That would circumvent the issue, right?

@pierpo pierpo added the bug Something isn't working label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants