-
Notifications
You must be signed in to change notification settings - Fork 3
/
nuxt.config.js
159 lines (152 loc) · 5.24 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
const i18n = require('./i18n')
let config = require('config')
config.basePath = '/simple-directory'
config.i18nMessages = i18n.messages
config.i18nLocales = config.i18n.locales.join(',')
config.readonly = config.storage.type !== 'mongo'
config.overwrite = (config.storage.type === 'ldap' && config.storage.ldap.overwrite) || []
const isBuilding = process.argv[2] === 'build'
if (process.env.NODE_ENV === 'production') {
const nuxtConfigInject = require('@koumoul/nuxt-config-inject')
if (isBuilding) config = nuxtConfigInject.prepare(config)
else nuxtConfigInject.replace(config, ['nuxt-dist/**/*', 'public/static/**/*'])
}
let vuetifyOptions = {}
if (process.env.NODE_ENV !== 'production' || isBuilding) {
const fr = require('vuetify/es5/locale/fr').default
const en = require('vuetify/es5/locale/en').default
vuetifyOptions = {
customVariables: ['~assets/variables.scss'],
theme: {
dark: config.theme.dark,
themes: {
light: config.theme.colors,
dark: { ...config.theme.colors, ...config.theme.darkColors }
}
},
treeShake: true,
defaultAssets: false,
lang: {
locales: { fr, en },
current: i18n.defaultLocale
}
}
}
module.exports = {
telemetry: false,
ssr: false,
components: true,
srcDir: 'public/',
buildDir: 'nuxt-dist',
build: {
transpile: [/@koumoul/, /@data-fair/],
babel: {
sourceType: 'unambiguous'
},
publicPath: '_nuxt/',
extend (webpackConfig, { isServer, isDev, isClient }) {
const webpack = require('webpack')
// webpackConfig.optimization.minimize = false
// Ignore all locale files of moment.js, those we want are loaded in plugins/moment.js
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
// source-map to debug in production
webpackConfig.devtool = webpackConfig.devtool || 'source-map'
}
},
loading: { color: '#1e88e5' }, // Customize the progress bar color
plugins: [
{ src: '~plugins/session', ssr: false },
{ src: '~plugins/query-params', ssr: false },
{ src: '~plugins/site-public', ssr: false },
{ src: '~plugins/vuetify' },
{ src: '~plugins/moment' },
{ src: '~plugins/axios' },
{ src: '~plugins/analytics', ssr: false },
{ src: '~plugins/iframe-resizer', ssr: false }
],
router: {
base: config.basePath
},
modules: ['@nuxtjs/markdownit', '@nuxtjs/axios', 'cookie-universal-nuxt', ['@nuxtjs/i18n', {
seo: false,
// cannot come from config as it must be defined at build time (routes are impacted
// we will override some of it at runtime using env.i18n
locales: i18n.locales,
defaultLocale: i18n.defaultLocale,
vueI18nLoader: true,
vueI18n: {
fallbackLocale: i18n.defaultLocale,
messages: config.i18nMessages
},
strategy: 'no_prefix',
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_lang'
}
}]],
axios: {
browserBaseURL: config.basePath
},
buildModules: [
'nuxt-webpack-optimisations',
'@nuxtjs/vuetify',
['@nuxtjs/google-fonts', { download: true, display: 'swap', families: { Nunito: [100, 300, 400, 500, 700, 900] } }]
],
webpackOptimisations: {
features: {
cacheLoader: false // cache is not available inside docker build
}
},
vuetify: vuetifyOptions,
env: {
mainPublicUrl: config.publicUrl,
basePath: config.basePath,
theme: config.theme,
homePage: config.homePage,
maildev: config.maildev,
defaultMaxCreatedOrgs: config.quotas.defaultMaxCreatedOrgs,
readonly: config.readonly,
overwrite: config.overwrite,
analytics: config.analytics,
onlyCreateInvited: config.onlyCreateInvited,
userSelfDelete: config.userSelfDelete,
tosUrl: config.tosUrl,
manageDepartments: config.manageDepartments,
manageDepartmentLabel: config.manageDepartmentLabel,
passwordless: config.passwordless,
i18nLocales: config.i18nLocales,
anonymousContactForm: config.anonymousContactForm,
noBirthday: config.noBirthday,
avatars: config.avatars,
perOrgStorageTypes: config.perOrgStorageTypes,
notifyUrl: config.notifyUrl,
plannedDeletionDelay: config.plannedDeletionDelay,
alwaysAcceptInvitation: config.alwaysAcceptInvitation,
depAdminIsOrgAdmin: config.depAdminIsOrgAdmin,
manageSites: config.manageSites,
managePartners: config.managePartners
},
head: {
title: config.i18nMessages[i18n.defaultLocale].root.title,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'application', name: 'application-name', content: i18n.messages[i18n.defaultLocale].root.title },
{ hid: 'description', name: 'description', content: i18n.messages[i18n.defaultLocale].root.description }
],
link: [
// /favicon.ico is not put un config/default.js to prevent a nuxt-config-inject bug
{ rel: 'icon', type: 'image/x-icon', href: config.theme.favicon || '/favicon.ico' }
],
style: []
},
css: [
'@mdi/font/css/materialdesignicons.min.css'
]
}
if (config.theme.cssUrl) {
module.exports.head.link.push({ rel: 'stylesheet', href: config.theme.cssUrl })
}
if (config.theme.cssText) {
module.exports.head.style.push({ type: 'text/css', cssText: config.theme.cssText })
}