-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnuxt.config.js
209 lines (174 loc) · 4.94 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
202
203
204
205
206
207
208
209
import pkg from './package'
require('dotenv').config()
console.log('>>> nuxt.config.js / process.env.NUXT_APP_CONFIG_NAME : ', process.env.NUXT_APP_CONFIG_NAME)
const envAppName = process.env.NUXT_APP_CONFIG_NAME || 'APIVIZ'
// console.log('>>> nuxt.config.js / process.env :\n', process.env)
console.log('>>> nuxt.config.js / process.env.NUXT_APIVIZ_UUID : ', process.env.NUXT_APIVIZ_UUID)
const envBackendMode = process.env.NUXT_BACKEND_MODE || 'default'
console.log('>>> nuxt.config.js / process.env.NUXT_BACKEND_MODE : ', envBackendMode)
const envAuthMode = process.env.NUXT_AUTH_MODE || 'default'
console.log('>>> nuxt.config.js / process.env.NUXT_AUTH_MODE : ', envAuthMode)
// const htmlFilesMode = process.env.NUXT_HTML_FILES || 'distant'
// console.log('>>> nuxt.config.js / process.env.NUXT_HTML_FILES : ', htmlFilesMode)
const logAllowed = ['dev', 'preprod']
const consoleLogMode = process.env.NUXT_CONSOLELOG || 'prod'
console.log('>>> nuxt.config.js / process.env.NUXT_CONSOLELOG :', consoleLogMode)
// cf : https://nuxtjs.org/faq/github-pages/
const envApivizRepo = process.env.APIVIZ_REPO || undefined
console.log('>>> nuxt.config.js / process.env.APIVIZ_REPO :', envApivizRepo)
const envDeployEnv = process.env.DEPLOY_ENV || undefined
console.log('>>> nuxt.config.js / process.env.DEPLOY_ENV :', envDeployEnv)
const routerBase = envApivizRepo && envDeployEnv === 'GH_PAGES' ? {
router: {
base: envApivizRepo
}
} : {}
export default {
mode: 'spa',
...routerBase,
// buildDir: 'src', // default : '.nuxt'
server: {
port: 3001 // default: 3000
// host: 'localhost' // '0.0.0.0', // default: localhost
},
/*
** ENV variables
cf : https://nuxtjs.org/api/configuration-env/
cf : https://samuelcoe.com/blog/nuxt-dotenv/
*/
env: {
AppConfigName: envAppName,
ApivizUUID: process.env.NUXT_APIVIZ_UUID,
BackendMode: envBackendMode,
ConsoleLog: logAllowed.includes(consoleLogMode),
AuthMode: envAuthMode
// HtmlFilesMode : htmlFilesMode,
},
/*
** Router config
cf : https://nuxtjs.org/api/configuration-router
*/
router: {
middleware: [
'setAppMode',
'getAppConfig',
'checkAuth',
'collapseNavbar'
]
// scrollBehavior: function (to, from, savedPosition) {
// return { x: 0, y: 0 }
// }
},
/*
** Headers of the page
*/
head: {
title: pkg.name + ' v.' + pkg.version,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description }
]
// link: [
// { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
// ]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
// Load a Node.js module directly (here it's a Sass file)
// 'bulma',
// CSS file in the project
// '@/assets/css/main.css',
// SCSS file in the project
'@/assets/css/main.scss'
],
/*
** Plugins to load before mounting the App
cf : https://nuxtjs.org/api/configuration-plugins
*/
plugins: [
{ src: '~plugins/vee-validate.js', ssr: false },
'~/plugins/translate',
// '~/plugins/axios',
// '~/plugins/checkTokens',
// '~/plugins/utils',
'~/plugins/json-editor',
// '~/plugins/turf-plugin',
{ src: '~/plugins/mapbox', mode: 'client' },
{ src: '~/plugins/apexCharts', mode: 'client' },
// { src: '~plugins/full-calendar', ssr: false }
{ src: '~plugins/vue-event-calendar', ssr: false }
],
/*
** Nuxt.js modules
*/
modules: [
['nuxt-validate', {
// lang: 'es',
// regular vee-validate options
}]
// Doc: https://axios.nuxtjs.org/usage
// '@nuxtjs/axios',
// to solve CORS problem
// '@nuxtjs/proxy',
// Doc: https://github.com/nuxt-community/modules/tree/master/packages/bulma
// '@nuxtjs/bulma',
// 'nuxt-fontawesome',
// 'nuxt-fontawesome', {
// imports: [
// {
// set: '@fortawesome/free-solid-svg-icons',
// icons: ['fas']
// },
// {
// set:'@fortawesome/free-brands-svg-icons',
// icons: ['fab']
// }
],
/*
** Axios module configuration (@nuxt/axios)
*/
// axios: {
// // See https://github.com/nuxt-community/axios-module#options
// // baseURL: '',
// debug: true,
// retry: {
// retries: 0
// },
// // proxy : true,
// credentials: false,
// proxyHeaders: false
// },
/*
** Build configuration
*/
build: {
transpile: ['vue-mapbox'],
extend (config, { isDev, isClient }) {
config.resolve.alias.vue = 'vue/dist/vue.common'
},
vendors: [
'axios',
// 'vee-validate',
'mapbox-gl'
// 'turf'
],
extractCSS: true
// postcss: {
// preset: {
// features: {
// customProperties: false
// }
// }
// },
/*
** You can extend webpack config here
*/
}
}