This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathnuxt.config.ts
189 lines (176 loc) Β· 5.63 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
const dotEnvSrc = process.env.NODE_ENV === 'production' ? './.prod.env' : './.dev.env';
const result = require('dotenv').config({
path: dotEnvSrc,
});
const environmentVariables = {
LOGGING: undefined,
SENTRY_DSN: undefined,
ENVIRONMENT: undefined,
API_URL: undefined,
CONTENT_PROXY_URL: undefined,
TERMS_OF_USE_MD_URL: undefined,
PRIVACY_POLICY_MD_URL: undefined,
COMMUNITY_GUIDELINES_MD_URL: undefined,
};
Object.keys(environmentVariables).forEach((envVar) => {
if (process.env[envVar]) environmentVariables[envVar] = process.env[envVar];
});
const frontendEnvVars = {
...result.parsed,
...environmentVariables,
};
Object.keys(environmentVariables).forEach((environmentVariable) => {
if (!frontendEnvVars[environmentVariable]) {
if (process.env.NODE_ENV === 'production') {
throw new Error(`Environment variable ${environmentVariable} is not present. Exiting.`)
} else {
console.log(`Environment variable ${environmentVariable} is not present.`);
}
}
});
export default {
mode: 'spa',
env: frontendEnvVars,
head: {
title: 'Okuna',
meta: [
{charset: 'utf-8'},
{name: 'viewport', content: 'width=device-width, initial-scale=1.0'},
{hid: 'description', name: 'description', content: 'Ethical social network.'},
{name: 'theme-color', content: '#ffffff'},
{name: 'msapplication-TileColor', content: '#000000'},
{
'property': 'og:title',
'content': `Okuna`,
},
{
'property': 'og:description',
'content': `Ethical Social Network.`,
},
{
'property': 'og:image',
'content': `https://okuna.io/og-image.png`
}
],
link: [
{rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'},
{rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png'},
{rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32x32.png'},
{rel: 'icon', type: 'image/png', sizes: '16x16', href: '/favicon-16x16.png'},
{rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#ffffff'},
],
},
loading: {color: '#000000'},
css: [
'~/assets/styles/index.scss',
'vue-popperjs/dist/vue-popper.css',
],
buildModules: [
'@nuxt/typescript-build',
'@nuxtjs/router',
],
modules: [
'@nuxtjs/sentry',
'@nuxtjs/axios',
'localforage-nuxt',
'nuxt-i18n',
'@nuxtjs/style-resources',
],
sentry: {
dsn: process.env.SENTRY_DSN,
},
axios: {
proxy: true
},
plugins: [
'~/plugins/buefy',
{src: '~/plugins/line-clamp', ssr: false},
'~/plugins/directives',
'~/plugins/vuelidate',
'~/plugins/di-vue',
'~/plugins/material-design-icons',
'~/plugins/vue-infinite-loading',
'~/plugins/vue-scroll-to',
'~/plugins/vue-sticky',
'~/plugins/vue-moment',
'~/plugins/vue-popper',
'~/plugins/vue-progressive-image',
'~/plugins/vue-video-player',
'~/plugins/vue-highlight',
'~/plugins/vue-tooltip',
'~/plugins/vue-rx',
'~/plugins/vue-not-visible',
'~/plugins/v-clipboard'
],
router: {
middleware: ['post-redirect'],
//mode: 'hash',
},
i18n: {
baseUrl: 'https://okuna.io',
lazy: true,
langDir: 'static/i18n/',
locales: [
{
code: 'en',
iso: 'en-US',
file: 'en.js',
name: 'English'
},
{
code: 'es',
iso: 'es-ES',
file: 'es.js',
name: 'Spanish'
},
],
// The app's default locale, URLs for this locale won't have a prefix if
// strategy is prefix_except_default
defaultLocale: 'en',
strategy: 'no_prefix',
// Enable browser language detection to automatically redirect user
// to their preferred language as they visit your app for the first time
detectBrowserLanguage: {
// If enabled, a cookie is set once a user has been redirected to his
// preferred language to prevent subsequent redirections
// Set to false to redirect every time
useCookie: true,
// Cookie name
cookieKey: 'i18n',
// Set to always redirect to value stored in the cookie, not just once
alwaysRedirect: false,
// If no locale for the browsers locale is a match, use this one as a fallback
fallbackLocale: 'en'
},
// We followed steps of https://nuxt-community.github.io/nuxt-i18n/seo.html#improving-performance
seo: false,
},
proxy: {
'/local/': {target: 'https://api.openbook.social', pathRewrite: {'^/local/': ''}},
'/contentproxy': {target: 'https://contentproxy.okuna.io', pathRewrite: {'^/contentproxy': ''}},
'/www/': {target: 'https://www.okuna.io', pathRewrite: {'^/www/': ''}},
},
styleResources: {
scss: [
'assets/styles/helpers/index.scss',
]
},
render: {
bundleRenderer: {
runInNewContext: false
}
},
build: {
devtools: true,
extend(config, {isDev, isClient}) {
config.node = {
fs: 'empty'
}
}
},
generate: {
routes: [
'/'
],
}
}