This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnuxt.config.ts
195 lines (169 loc) · 3.95 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
import NuxtConfiguration from '@nuxt/config'
import { config as dotenv } from 'dotenv'
dotenv()
const version = require('./package.json').version
const isDevelopment = (process.env.NODE_ENV === 'development')
const isLocal = (process.env.LOCAL === '1')
let envPrefix: string
if (process.env.NODE_ENV === 'production') {
envPrefix = 'PROD'
} else if (process.env.NODE_ENV === 'staging') {
envPrefix = 'STAGE'
} else {
envPrefix = 'DEV'
}
const proxyConfiguration = !isDevelopment ? {} : { proxy: {
'/api': { target: 'http://localhost:3001' }
}}
const axiosBaseURL = !isDevelopment ? process.env.LINK_API_BASE_URL : '/api'
const config: NuxtConfiguration = {
mode: 'spa',
/*
** Headers of the page
*/
head: {
title: 'Join WWDCScholars!',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content:
'Are you a WWDC 2021 Swift Student Challenge Winner? Sign up now!'
},
{ name: 'keywords', content: 'WWDCScholars,WWDC,Scholars,Apple' },
{ name: 'author', content: 'WWDCScholars' },
{ name: 'og:image', content: '/icons/fb-og-image.png' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/icons/favicon.ico' },
{
rel: 'apple-touch-icon-precomposed',
href: '/icons/favicon-180.png',
sizes: '180x180'
},
{
rel: 'apple-touch-icon-precomposed',
href: '/icons/favicon-152.png',
sizes: '152x152'
},
{
rel: 'apple-touch-icon-precomposed',
href: '/icons/favicon-120.png',
sizes: '120x120'
}
]
},
/*
** Inject process environment variables
*/
env: {
...process.env as any
},
/*
** Customize the progress-bar color
*/
loading: {
color: 'rgb(65, 53, 153)',
failedColor: '#D83946'
},
/*
** Global CSS
*/
css: ['~assets/sass/app/_index.sass'],
/*
** Plugins to load before mounting the App
*/
plugins: [
'~/plugins/vee-validate',
'~/plugins/vue2-google-maps',
'~/plugins/validation-helper',
'~/plugins/auth'
],
/*
** Nuxt.js modules
*/
modules: [
// Load global SASS variables and mixins
'@nuxtjs/style-resources',
// Load environment variables from `.env`
'@nuxtjs/dotenv',
// CloudKit connection
['~/cloudkit/nuxt-module', {
containerIdentifier: process.env[`${envPrefix}_CLOUDKIT_CONTAINER_IDENTIFIER`],
apiToken: process.env[`${envPrefix}_CLOUDKIT_API_TOKEN`],
environment: process.env[`${envPrefix}_CLOUDKIT_ENVIRONMENT`]
}],
// Load Plausible Analytics
'vue-plausible',
// Axios for linking api
'@nuxtjs/proxy',
'@nuxtjs/axios',
// Load sentry
'@nuxtjs/sentry'
],
/*
** Global SASS variables and mixins
*/
styleResources: {
sass: ['~assets/sass/imports/_index.sass']
},
/*
** Linking API proxy configuration
*/
...proxyConfiguration,
/*
** Linking API configuration
*/
axios: {
baseURL: axiosBaseURL
},
/*
** Plausible Analytics configuration
*/
plausible: {
domain: process.env[`${envPrefix}_PLAUSIBLE_DOMAIN`],
apiHost: process.env[`${envPrefix}_PLAUSIBLE_API_HOST`]
},
/*
** Sentry configuration
*/
sentry: {
disabled: false,
dsn: process.env.SENTRY_DSN,
config: {
environment: process.env.SENTRY_ENVIRONMENT,
release: `form@v${version}`,
autoBreadcrumbs: {
'ui': false,
'location': true,
'xhr': true
}
}
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config: any) {
config.node = {
fs: 'empty'
}
// enable source maps
if (isLocal) {
config.devtool = '#source-map'
}
}
},
/*
** Generate a 404 page
*/
generate: {
fallback: '404.html'
}
}
export default config