Vue.js
Beginner
1 min read
Creating a Vue App with Vite
Example
// src/main.ts — app entry point generated by create-vue
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import router from './router';
import App from './App.vue';
import './assets/main.css';
const app = createApp(App);
app.use(createPinia());
app.use(router);
app.mount('#app');
// src/App.vue (abridged)
// <template>
// <RouterView />
// </template>
//
// <script setup lang="ts">
// import { RouterView } from 'vue-router';
// </script>
// Useful npm scripts in package.json:
// "dev" : "vite" — start dev server
// "build" : "vite build" — production bundle
// "preview": "vite preview" — preview prod build
// "test" : "vitest" — run unit tests