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

Production build rise an error in runtime #10806

Closed
inoyakaigor opened this issue Apr 29, 2020 · 4 comments
Closed

Production build rise an error in runtime #10806

inoyakaigor opened this issue Apr 29, 2020 · 4 comments

Comments

@inoyakaigor
Copy link

Bug report

What is the current behavior?
Minification and concatenating modify code in that way which rise an error in runtime.
Minimal reproduce repo and it can be seen here https://inoyakaigor.github.io/

If the current behavior is a bug, please provide the steps to reproduce.
Open https://inoyakaigor.github.io/, open devtools, reload.

What is the expected behavior?
I expect webpack to modify the code so that it will work. I realize that when webpack builds code, it doesn't know what happens at runtime, and I'm not sure that it can be fixed in principle.

Other relevant information:
I think this issue relevant to #8902 because the error can be fixed if set to false the optimization.minimize and optimization.concatenateModules

If you after look in code start thinking about circular dependicies or something you also should to know that way to connecting store via the root store described in Mobx best practices

webpack version: 4.43.0
Node.js version: 14
Operating System: macos 10.14
Additional tools:
React: 16.13.1
Mobx: 5.15.4
Typescript: 3.8.3

@sokra
Copy link
Member

sokra commented Apr 29, 2020

Minimizing changes function names due to mangling. Do not rely on function names.

@inoyakaigor
Copy link
Author

So there is no way to fix it from the webpack?

@alexander-akait
Copy link
Member

alexander-akait commented Apr 30, 2020

@inoyakaigor minimize: { mangle: false } and concatenateModules: false but it is increase bundle size what is not recommended

Just do not rely on functions names

@inoyakaigor
Copy link
Author

I found the solution and described it in my blog (in Russian)

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

3 participants