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

0.18.0 broke some imports #208

Closed
charlag opened this issue Aug 2, 2021 · 6 comments
Closed

0.18.0 broke some imports #208

charlag opened this issue Aug 2, 2021 · 6 comments

Comments

@charlag
Copy link
Contributor

charlag commented Aug 2, 2021

Hi

Just tried upgrading to 0.18.0 for Tutanota and the app stopped loading. The reason it the superclass is not imported (this import is not defined: https://github.com/tutao/tutanota/blob/fd7c8d8c0b010cb5af535ede5da347d812e40ef7/src/api/common/error/RestError.js#L3)

generated code looks like this:

var _i0; var _defineProperty;; var _i1; var TutanotaError;

class ConnectionError extends TutanotaError {
   //...
 }

and TutanotaError is obviously undefined at this point. I think there's some missing condition for hoisting.

If you want to run it yourself, you can clone, change nollup to 0.18.0, npm i, node make and point any http server to build folder. I might come up with a better example later but maybe you already have an idea what might be wrong.

@PepsRyuu
Copy link
Owner

PepsRyuu commented Aug 2, 2021

Thanks for the report. I'll have a look into this later today for you!

@PepsRyuu
Copy link
Owner

PepsRyuu commented Aug 2, 2021

It seems like RestError isn't part of a circular chain itself, but that it happens to be a dependency of a circular chain, and therefore was hoisted even though it didn't need to be. Some dependencies of circular chains do need to be hoisted, so there is definitely a missing condition needed to make that determination. Will investigate further.

@charlag
Copy link
Contributor Author

charlag commented Aug 2, 2021

Sounds like it! Thanks for looking into it. No pressure, we are in no hurry to update.

@PepsRyuu
Copy link
Owner

PepsRyuu commented Aug 2, 2021

I think I found the problem. I'm hoisting ClassDeclaration but it is not supposed to be hoisted, just the name of the class is supposed to be hoisted. The implementation is supposed to stay exactly where it is.

(function () {
    new MyClass(); // fails saying cannot access MyClass before initialization
    class MyClass {}
})()

Working on a fix, hopefully will have something published in a bit. :)

@PepsRyuu
Copy link
Owner

PepsRyuu commented Aug 2, 2021

Fixed in 0.18.1!

@charlag
Copy link
Contributor Author

charlag commented Aug 2, 2021

Great, thanks, it works now!

@charlag charlag closed this as completed Aug 2, 2021
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

2 participants