-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
104 lines (101 loc) · 2.4 KB
/
vite.config.ts
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 { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; // https://vitejs.dev/config/
import svgr from 'vite-plugin-svgr';
import postcssNesting from 'postcss-nesting';
import postcssPresetEnv from 'postcss-preset-env';
import autoprefixer from 'autoprefixer';
import htmlPlugin from 'vite-plugin-html-config';
import tsconfigPaths from 'vite-tsconfig-paths';
import fs from 'fs';
import dotenv from 'dotenv';
dotenv.config();
const app = {
title: 'Secure Message Link',
description:
'An app that allows you encrypt a message and share it with a link.',
images: {
facebook: false,
twitter: false,
},
};
export default defineConfig({
css: {
postcss: {
plugins: [postcssNesting, autoprefixer, postcssPresetEnv],
},
},
...(fs.existsSync(process.env.SSL_KEY || '') &&
fs.existsSync(process.env.SSL_CRT || '')
? {
server: {
https: {
key: fs.readFileSync(process.env.SSL_KEY || ''),
cert: fs.readFileSync(process.env.SSL_CRT || ''),
},
port: process.env.PORT ? parseInt(process.env.PORT) : 8080,
},
}
: {}),
plugins: [
react(),
svgr(),
tsconfigPaths(),
htmlPlugin({
title: app.title,
metas: [
{
name: app.title,
content: app.description,
},
...(app?.images?.facebook
? [
{
name: 'og:image',
content: app.images.facebook,
},
]
: []),
{
name: 'og:title',
content: app.title,
},
{
name: 'og:description',
content: app.description,
},
{
name: 'og:locale',
content: 'en_US',
},
{
name: 'og:type',
content: 'website',
},
{
name: 'twitter:card',
content: 'summary_large_image',
},
{
name: 'twitter:creator',
content: '@nic_o_martin',
},
{
name: 'twitter:title',
content: app.title,
},
{
name: 'twitter:description',
content: app.description,
},
...(app?.images?.twitter
? [
{
name: 'twitter:image',
content: app.images.twitter,
},
]
: []),
],
}),
],
});