Edit this page
getGlobalContextSync()
& getGlobalContextAsync()
⚠️getGlobalContextSync()
andgetGlobalContextAsync()
are beta features: expect breaking changes in any minor version update.
getGlobalContextSync()
and getGlobalContextAsync()
allow you to access global information about your app.
Most notably the assets manifest.
The
globalContext
object also contains internals (they are prefixed with_
, e.g.globalContext._viteDevServer
). You should use them only if strictly needed, and if you do then let us know so that we make what you need part of the official API.
In certain situations, you may need to use
await getGlobalContextAsync()
instead ofgetGlobalContextSync()
. ThegetGlobalContextSync()
function will let you know when that is the case.