feat(config): allow app to run in a subfolder via BASE_URL (#461)

* fix: allow hosting in subfolder via BASE_URL

* Import baseUrl from config

* Revert "Import baseUrl from config"

This reverts commit 73c867ebc8.

* feat(config): fallback baseUrl to /

* feat(config): fallback baseUrl to /

---------

Co-authored-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
Seb 2023-06-19 17:42:29 +01:00 committed by GitHub
parent c4cec9e18f
commit 63045951e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>IT Tools - Handy online tools for developers</title>
<meta itemprop="name" content="IT Tools - Handy online tools for developers" />
@ -14,13 +14,13 @@
itemprop="description"
content="Collection of handy online tools for developers, with great UX. IT Tools is a free and open-source collection of handy online tools for developers & people working in IT."
/>
<link rel="author" href="/humans.txt" />
<link rel="author" href="humans.txt" />
<link rel="canonical" href="https://it-tools.tech" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#18a058" />
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png" />
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#18a058" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />

View File

@ -16,6 +16,8 @@ import Icons from 'unplugin-icons/vite';
import IconsResolver from 'unplugin-icons/resolver';
import VueI18n from '@intlify/unplugin-vue-i18n/vite';
const baseUrl = process.env.BASE_URL ?? '/';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
@ -55,7 +57,7 @@ export default defineConfig({
description: 'Aggregated set of useful tools for developers.',
display: 'standalone',
lang: 'fr-FR',
start_url: '/?utm_source=pwa&utm_medium=pwa',
start_url: `${baseUrl}?utm_source=pwa&utm_medium=pwa`,
orientation: 'any',
theme_color: '#18a058',
background_color: '#f1f5f9',
@ -92,6 +94,7 @@ export default defineConfig({
}),
Unocss(),
],
base: baseUrl,
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),