-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathvite.config.mts
104 lines (103 loc) · 2.87 KB
/
vite.config.mts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { defineConfig } from 'vite'
import envCompatible from 'vite-plugin-env-compatible'
import EnvironmentPlugin from 'vite-plugin-environment'
import { createHtmlPlugin } from 'vite-plugin-html'
import { VitePWA } from 'vite-plugin-pwa'
import { BikeTagDefaults, BikeTagEnv } from './src/common/constants'
const host = process.env.HOST ?? BikeTagDefaults.host
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: [
{
find: '@',
replacement: path.resolve(__dirname, 'src'),
},
],
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
},
css: {
preprocessorOptions: {
scss: { charset: false, additionalData: `@import "./src/assets/styles/mixins.scss";` },
css: { charset: false },
},
},
plugins: [
vue(),
EnvironmentPlugin(BikeTagEnv),
VitePWA({
srcDir: 'src',
// filename: 'worker.ts',
strategies: 'generateSW',
registerType: 'autoUpdate',
includeAssets: ['**/*'],
// includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'mask-icon.png'],
manifest: {
name: BikeTagDefaults.manifest.name,
short_name: BikeTagDefaults.manifest.shortName,
description: BikeTagDefaults.manifest.description,
theme_color: BikeTagDefaults.manifest.themeColor,
icons: [
{
src: `https://${host}/android-chrome-192x192.png`,
sizes: '192x192',
type: 'image/png',
purpose: 'any',
},
{
src: `https://${host}/android-chrome-512x512.png`,
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: `https://${host}/maskable_icon_x512.png`,
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
screenshots: [
{
src: `https://${host}/images/biketag-screen-desktop-1.webp`,
sizes: '389x366',
type: 'image/webp',
form_factor: 'wide',
label: 'BikeTag',
},
{
src: `https://${host}/images/biketag-screen-mobile-1.webp`,
sizes: '321x609',
type: 'image/webp',
form_factor: 'narrow',
label: 'BikeTag',
},
],
},
}),
viteCommonjs(),
envCompatible(),
createHtmlPlugin(),
],
build: {
sourcemap: true,
rollupOptions: {
output: {
entryFileNames: `assets/biketag.js`,
chunkFileNames: `assets/vendor.js`,
assetFileNames: `assets/[name].[ext]`,
},
},
},
// root: './public',
server: {
host: 'seattle.localhost',
port: 8080,
},
preview: {
port: 8080,
},
})