-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
250 lines (224 loc) · 6.23 KB
/
nuxt.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
import { NuxtConfig } from '@nuxt/types'
import { MetaInfo } from 'vue-meta'
import nuxtFirebaseConfiguration from './nuxt-firebase.config'
import {
extendTheme as chakraUiExtendedTheme,
customIcons,
} from './nuxt-chakra-ui.config'
import { WEBSITE_NAME, WEBSITE_DESCRIPTION, VIEWPORTS } from './utils/constants'
const generateLazyFontLinkTags = (url: string, preconnect?: string) => {
const tags: MetaInfo['link'] = [
{ rel: 'preload', as: 'style', href: url },
{
rel: 'stylesheet',
media: 'print',
onload: "this.media='all'",
href: url,
},
]
if (preconnect)
tags.push({
rel: 'preconnect',
href: preconnect,
crossOrigin: 'anonymous',
})
return tags
}
const hid = (info: Exclude<MetaInfo['meta'], undefined>[number]) => {
if (info.name) {
const { name, ...others } = info
return { hid: name, name, ...others }
}
if (info.property) {
const { property, ...others } = info
return { hid: property, property, ...others }
}
throw new Error('unknown meta info')
}
const config: NuxtConfig = {
// Enable server-side rendering: https://go.nuxtjs.dev/ssr-mode
// for full static generation
ssr: true,
// Target: https://go.nuxtjs.dev/config-target
target: 'static',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
titleTemplate: (titleChunk) => {
// WEBSITE_NAME from utils/constants.ts
const name = '藝大 オンライン憩い ☕'
return titleChunk ? `${titleChunk} | ${name}` : name
},
htmlAttrs: { lang: 'ja' },
meta: [
hid({ property: 'og:locale', content: 'ja' }),
hid({ name: 'robots', content: 'noindex' }),
hid({ name: 'msapplication-TileColor', content: '#00aba9' }),
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{
rel: 'apple-touch-icon',
href: '/apple-touch-icon.png',
sizes: '180x180',
},
{
rel: 'icon',
type: 'image/png',
href: '/favicon-32x32.png',
sizes: '32x32',
},
{
rel: 'icon',
type: 'image/png',
href: '/favicon-16x16.png',
sizes: '16x16',
},
{ rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#545b61' },
...generateLazyFontLinkTags(
'https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap'
),
...generateLazyFontLinkTags(
'https://fonts.googleapis.com/css2?family=Open+Sans:wght@700&display=swap'
),
],
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: ['~assets/fonts/css/ibm-plex-sans-jp.min.css'],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/vue-gtag.ts',
{ src: '@/plugins/vuex-persistedstate.client.ts', mode: 'client' },
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/typescript
'@nuxt/typescript-build',
// https://typed-vuex.roe.dev/
'nuxt-typed-vuex',
// https://github.com/nuxt-community/svg-module
'@nuxtjs/svg',
// https://github.com/nuxt-community/device-module
'@nuxtjs/device',
// https://github.com/nuxt-community/style-resources-module/
'@nuxtjs/style-resources',
// https://image.nuxtjs.org/
'@nuxt/image',
// https://pwa.nuxtjs.org/
'@nuxtjs/pwa',
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/chakra
'@chakra-ui/nuxt',
// https://go.nuxtjs.dev/emotion
'@nuxtjs/emotion',
// https://go.nuxtjs.dev/axios
'@nuxtjs/axios',
// https://firebase.nuxtjs.org/guide/options/
'@nuxtjs/firebase',
],
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
quiet: false,
},
// https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-generate/
generate: {
fallback: true,
// Exclude pages from SSG
exclude: ['/meet/'] as any,
},
router: {
trailingSlash: true,
middleware: ['redirect'],
},
firebase: nuxtFirebaseConfiguration,
emotion: {
ssr: false,
},
chakra: {
config: {
autoImport: true,
},
extendTheme: chakraUiExtendedTheme,
icons: {
extend: {
...customIcons,
},
},
},
publicRuntimeConfig: {
configDatabaseId: process.env.NOTION_DATABASE_CONFIG,
newsDatabaseId: process.env.NOTION_DATABASE_NEWS,
meetLinksDatabaseId: process.env.NOTION_DATABASE_MEETLINKS,
modalNoticesDatabaseId: process.env.NOTION_DATABASE_MODALNOTICES,
appointmentCalendarsId: process.env.NOTION_DATABASE_APPOINTMENTCALS,
},
styleResources: {
scss: ['~assets/abstracts/_mixins.scss'],
},
image: {
screens: VIEWPORTS,
},
pwa: {
icon: false,
meta: {
charset: 'utf-8',
viewport: 'width=device-width, initial-scale=1',
modileApp: true,
mobileAppIOS: true,
appleStatusBarStyle: 'default',
favicon: false,
name: undefined,
author: 'MaySoMusician',
description: WEBSITE_DESCRIPTION,
theme_color: '#ffffff',
lang: 'ja',
ogType: 'website',
ogSiteName: WEBSITE_NAME,
ogDescription: WEBSITE_DESCRIPTION,
nativeUI: true,
},
manifest: {
name: WEBSITE_NAME,
short_name: 'オンライン憩い',
description: WEBSITE_DESCRIPTION,
icons: [
{
src: '/android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/android-chrome-256x256.png',
sizes: '256x256',
type: 'image/png',
},
],
theme_color: '#ffffff',
background_color: '#ffffff',
display: 'standalone',
lang: 'ja',
},
workbox: {
offline: false,
},
},
watchers: {
webpack: {
poll: true,
},
},
}
if (!config.env) {
config.env = {}
}
if (process.env.APP_DEBUG && process.env.APP_DEBUG !== '0') {
// eslint-disable-next-line no-console
console.log('!!! APPLICATION DEBUG ENABLED !!!')
config.env.APP_DEBUG = process.env.APP_DEBUG
}
export default config