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

🐛 BUG: define:vars breaking on hoisted scripts with --experimental-static-build #2505

Closed
Chrissdroid opened this issue Jan 31, 2022 · 7 comments
Assignees

Comments

@Chrissdroid
Copy link
Contributor

What version of astro are you using?

0.22.20

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

Any defined variable in define:vars is scrapped from rendered page when --experimental-static-build is set to true and hoist is set also to true

Works if hoist is set to false or --experimental-static-build is set to false

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-xrbux4?file=src%2Fcomponents%2FTour.astro&on=stackblitz

@jonathantneal
Copy link
Contributor

Verified. This may be a current limitation, but I’m not certain and I can see in your excellent example that there is no warning flag.

@Chrissdroid
Copy link
Contributor Author

apart from "variable is undefined" the console is empty, i found this by checking files via the sources tab on devtools

@matthewp
Copy link
Contributor

Thanks, I'm currently taking a look. This is true of styles as well, not hadn't implemented define:vars behind that flag yet.

@Chrissdroid
Copy link
Contributor Author

Chrissdroid commented Jan 31, 2022

May keep the issue stale for now to avoid duplicates and link the future PR later then ?

@matthewp
Copy link
Contributor

Not sure I follow but we can keep this issue open if thats what you mean.

@Chrissdroid
Copy link
Contributor Author

Sorry, I meant to leave the issue open for the moment while waiting for an implementation in order to avoid duplicates

@matthewp
Copy link
Contributor

Fixed by #2511, should go out in the next (prerelease most likely)

@matthewp matthewp closed this as completed Feb 4, 2022
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