-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Compiler declares variable with let
causing ReferenceError when trying to access it before initialization
#8787
Labels
Comments
I think you have cyclic imports. |
@kdy1 Thanks, it was circular deps in Sequalize models. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
When trying to execute the compiled project it fails with
ReferenceError: Cannot access 'X' before initialization
. The reason is that the variable is declared usinglet
(not hoisted), so accessing it from the code above is forbidden.Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.4.11&code=H4sIAAAAAAAAA02OwQ6CMBBE7%2F2KvQEJ%2FgAYg3qGk3dTYcEmW4rdElHDv9uWxHjb3ZmdN0pPxjr4CICzoVmPOVzkjTCHI5F5NjNRLlbordGQMD5mJPXGnXtNyK1Vk0tKIar4koYQF6ZGaiwgae%2FSXTUyywE58TGZwCXiWpLMcPZ6vcmAi8OxY6hNh3SSjPs%2F9RD7Vb9GaS%2BJMQu3rXREA%2FQKqfNg59M8D2ANnrAVwM6qcSjFKr54bfeu8wAAAA%3D%3D&config=H4sIAAAAAAAAA3VRPU%2FDQAzd%2Bysijwi10JEJCQaWsDEhBnNxSsp9yXakRlX%2FO3dpLk0Gprv33tnv2XfeVBUcxcBTdU7XBCKyEM84MTJ4xVNiQIdIYriLCvdFVclSi1Zo5hoygVEDS5KU%2B0m5XA9Q5ANpbkiyf9g%2FQuEZvbSB3dLd0gHN8Fo6%2Fu9Vk2KDipPlytGGILQuBTopsUf7RjbSmHSp%2FhLFF4si7%2BhoPcaof6PQB9s8xHYnbMoMEfVHlvmfd3cJft4qt4mY0Nc15GYKCi40vaXbX%2BR9ZwcTnAv%2BKDC%2FlNCzoRrjMhq4znftsJwEOqlL03Erlz%2FvHLIU8gEAAA%3D%3D
SWC Info output
Expected behavior
or to define properties at the end of a file.
Actual behavior
Version
1.4.11
Additional context
No response
The text was updated successfully, but these errors were encountered: