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
feat(vite): introduce hmrTopLevelAwait
option
#2066
Conversation
✅ Deploy Preview for unocss ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Similar to #1981 |
I think we should better make an option, so ppl can opt-out if needed, while the majority could still benefit from it. |
I added a switch to the top-level await feature in the configuration. I'm not familiar with the unocss code yet, so feel free to point out if there is something wrong with the changes |
playground/vite.config.ts
Outdated
@@ -13,7 +13,9 @@ export default defineConfig({ | |||
}, | |||
plugins: [ | |||
Vue(), | |||
Unocss(), | |||
UnoCSS({ | |||
topLevelAwait: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
playground/vite.config.ts
Outdated
@@ -13,7 +13,9 @@ export default defineConfig({ | |||
}, | |||
plugins: [ | |||
Vue(), | |||
Unocss(), | |||
UnoCSS({ | |||
hmrTopLevelAwait: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please allow me add this option to test uno's vite plugin, it doesn't affect anything. @antfu
Thank you very much for helping me to improve the code |
hmrTopLevelAwait
option
Summary
Sometimes I need to develop in restricted environments to debug the compatibility of certain code on a particular platform, but recently unocss has been using top-level await's in development mode, causing my code to not work properly in these restricted environments, which makes it very inconvenient to have to build and release the project for testing.
fix #2031, fix #2025, close #1981