forked from longjiang/zerotohero-nuxt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.js
201 lines (186 loc) · 5.67 KB
/
nuxt.config.js
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
export default {
env: {
baseUrl: process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'http://localhost:3000'
},
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'Zero to Hero Languages',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
// { name: 'referrer', content: 'no-referrer'}, // Turned off because some youtube videos will not load.
{ name: 'viewport', content: 'viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' },
{ name: "apple-itunes-app", content: "app-id=1623985525" }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/img/icons/favicon.ico' },
{ rel: 'stylesheet', href: '/vendor/fontawesome-free-5.15.4-web/css/all.min.css' },
{ rel: 'stylesheet', href: '/fonts/fonts.css' },
],
script: [
{ hid: 'russian-legacy', src: '/js/russian-legacy.js', defer: true },
{ hid: 'papaparse', src: '/vendor/papaparse/papaparse.min.js', defer: true },
{ hid: 'jquery', src: '/vendor/jquery/jquery.min.js', defer: true },
{ hid: 'axios', src: '/vendor/axios/axios.min.js', defer: true },
{ hid: 'underscore', src: '/vendor/underscore/underscore.js', defer: true },
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'css-percentage-circle',
'video.js/dist/video-js.css',
'@/assets/css/zerotohero.scss',
],
router: {
middleware: [
'language-switch',
]
},
vue: {
config: {
runtimeCompiler: true
}
},
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
pwa: {
icon: {
fileName: 'icon3.png', // Renamed from icon.png in order for the pwa module to regenerate updated icons
purpose: 'maskable', // So that the user's os will add masking/padding around the icon (rounded corner, circle, etc)
},
manifest: {
name: 'Zero to Hero Education',
short_name: 'Zero to Hero',
description: 'Language education done right.',
theme_color: '#343a40',
useWebmanifestExtension: false
},
workbox: {
cacheAssets: [
'/workers/dict-worker.js',
'/js/dialect-dict.js',
'/js/ecdict.js',
'/js/edict.js',
'/js/freedict.js',
'/js/hsk-cedict.js',
'/js/kengdic.js',
'/js/klingonska.js',
'/js/openrussian.js',
'/js/russian-legacy.js',
'/js/wiktionary.js',
],
runtimeCaching: [{
urlPattern: 'http://server.chinesezerotohero.com/.*',
handler: 'CacheFirst',
options: {
cacheName: 'dictionaries',
expiration: {
maxEntries: 10,
},
},
}],
}
},
modules: [
'bootstrap-vue/nuxt',
'@nuxtjs/axios',
'nuxt-i18n',
'@nuxtjs/google-fonts',
'@nuxtjs/auth-next',
'@nuxtjs/toast',
['nuxt-lazy-load', {
// These are the default values
native: false, // https://caniuse.com/loading-lazy-attr
directiveOnly: false,
// Default image must be in the static folder
defaultImage: '/img/placeholder-faded.png',
}]
],
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
['@nuxtjs/router-extras', { /* module options */ }],
'@nuxtjs/pwa'
],
toast: {
position: 'top-center'
},
auth: {
redirect: {
login: false,
logout: false,
callback: false,
home: false
},
strategies: {
local: {
scheme: 'refresh',
token: {
property: 'data.token',
global: true,
maxAge: 60 * 60 * 24 * 30, // Set in Directus settings
// required: true,
// type: 'Bearer'
},
refreshToken: {
property: 'data.token',
data: 'token',
maxAge: 60 * 60 * 24 * 30
},
user: {
property: 'data.user',
autoFetch: false
},
endpoints: {
login: { url: 'https://db2.zerotohero.ca/zerotohero/auth/authenticate', method: 'post' },
refresh: { url: 'https://db2.zerotohero.ca/zerotohero/auth/refresh', method: 'post' },
logout: { url: 'https://db2.zerotohero.ca/zerotohero/auth/logout', method: 'post' },
user: false
}
}
}
},
bootstrapVue: {
components: ['BForm', 'BCard', 'BFormInput', 'BFormFile', 'BFormGroup', 'BFormSelect', 'BFormTextarea', 'BFormSelectOption', 'BButton', 'BProgress', 'BTable',
'BDropdown', 'BDropdownItem', 'BFormCheckbox', 'BFormCheckboxGroup', 'BFormRadio', 'BButtonGroup', 'BInputGroup', 'BInputGroupAppend', 'BInputGroupText', 'BDropdownDivider', 'BProgressBar', 'BModal'],
directives: ['VBModal']
},
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'~plugins/main.js',
{ src: '~/plugins/pwa-update.js', mode: 'client' },
{ src: '~/plugins/vuex-persist.js', mode: 'client' },
{ src: '~/plugins/shared-mutations.js', mode: 'client' },
{ src: '~/plugins/idle-vue.js', mode: 'client' },
],
build: {
/* Extending webpack config */
/* https://vue-loader.vuejs.org/guide/css-modules.html */
loaders: {
cssModules: {
modules: true
}
},
extend(config, { isDev, isClient }) {
config.resolve.alias['vue'] = 'vue/dist/vue.common'
// Extend only webpack config for client-bundle
if (isDev && isClient) {
config.devtool = '#source-map'
} else {
config.devtool = false
}
},
transpile: [
'iframe-translator'
]
},
target: 'static',
generate: {
routes: [
'/',
],
fallback: true,
crawler: false
}
}