You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.ts 693 B

2 years ago
2 years ago
2 years ago
12345678910111213141516171819202122
  1. import { ViteSSG } from 'vite-ssg'
  2. import { setupLayouts } from 'virtual:generated-layouts'
  3. import Previewer from 'virtual:vue-component-preview'
  4. import App from './App.vue'
  5. import type { UserModule } from './types'
  6. import generatedRoutes from '~pages'
  7. import 'uno.css'
  8. import './styles/main.css'
  9. const routes = setupLayouts(generatedRoutes)
  10. // https://github.com/antfu/vite-ssg
  11. export const createApp = ViteSSG(
  12. App,
  13. { routes, base: import.meta.env.BASE_URL },
  14. (ctx) => {
  15. // install all modules under `modules/`
  16. Object.values(import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }))
  17. .forEach(i => i.install?.(ctx))
  18. ctx.app.use(Previewer)
  19. },
  20. )