docs: warn about modules with side-effects (#19592)

This commit is contained in:
Julien Huang 2023-03-11 22:26:50 +01:00 committed by GitHub
parent b19b35fb67
commit 4163bb8d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,10 @@ Universal rendering allows a Nuxt application to provide quick page load times w
For more examples about writing Vue code without hydration mismatch, see [the Vue docs](https://vuejs.org/guide/scaling-up/ssr.html#hydration-mismatch).
::
::alert{type=warning}
When importing a library that relies on browser APIs and has side effects, make sure the component importing it is only called client-side. Bundlers do not treeshake imports of modules containing side effects.
::
### Examples
Universal rendering is very versatile and can fit almost any use case, and is especially appropriate for any content-oriented websites: **blogs, marketing websites, portfolios, e-commerce sites, and marketplaces.**