@afe1/vite-plugin-app-loading
v0.1.2
Published
Inject a loading overlay into Vite HTML and expose a manual remover for app startup.
Downloads
50
Maintainers
Readme
@afe1/vite-plugin-app-loading
Inject a startup loading overlay into Vite HTML, then remove it manually when your app is ready.
Install
pnpm add -D @afe1/vite-plugin-app-loadingUsage
// vite.config.ts
import { defineConfig } from 'vite';
import { viteInjectAppLoadingPlugin } from '@afe1/vite-plugin-app-loading';
export default defineConfig({
plugins: [
viteInjectAppLoadingPlugin()
]
});Remove the loading overlay after your framework has mounted:
// src/main.ts
import { removeAppLoading } from 'virtual:app-loading';
// Mount React, Vue, Svelte, or any other app first.
removeAppLoading();If TypeScript cannot resolve the virtual module, add this once to your Vite env declarations:
/// <reference types="@afe1/vite-plugin-app-loading" />Options
function viteInjectAppLoadingPlugin(): Plugin;Thanks
Thanks to vue-vben-admin for the inspiration.
