project configuration

This commit is contained in:
Sylvain Schneider
2026-05-11 22:27:45 +02:00
parent d729a7a919
commit caf085310c
4 changed files with 60 additions and 26 deletions

View File

@@ -86,6 +86,57 @@ app.use(PrimeVue, {
app.mount('#app') app.mount('#app')
``` ```
## Adaptation du Router
Modification du fichier ```src/router/index.js```
```ts
import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHashHistory(),
routes: [
{
path: '/',
name: 'home',
component: HomeView,
},
],
})
export default router
```
Modification du fichier ```vite.config.js```
```ts
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
],
base: './',
build: {
// Optional: specify the output directory for the build
outDir: 'dist',
assetsDir: 'assets',
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
})
```
## Construction de l'application ## Construction de l'application
``` ```

View File

@@ -1,22 +1,14 @@
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue' import HomeView from '../views/HomeView.vue'
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHashHistory(),
routes: [ routes: [
{ {
path: '/', path: '/',
name: 'home', name: 'home',
component: HomeView, component: HomeView,
}, },
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue'),
},
], ],
}) })

View File

@@ -1,15 +0,0 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<style>
@media (min-width: 1024px) {
.about {
min-height: 100vh;
display: flex;
align-items: center;
}
}
</style>

View File

@@ -10,6 +10,12 @@ export default defineConfig({
vue(), vue(),
vueDevTools(), vueDevTools(),
], ],
base: './',
build: {
// Optional: specify the output directory for the build
outDir: 'dist',
assetsDir: 'assets',
},
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)) '@': fileURLToPath(new URL('./src', import.meta.url))