gancio-upstream/nuxt.config.js

176 lines
3.9 KiB
JavaScript
Raw Normal View History

2021-10-18 12:48:45 +02:00
const config = require('./server/config.js')
const minifyTheme = require('minify-css-string').default
const locales = require('./locales/index')
2021-10-18 12:48:45 +02:00
const isDev = (process.env.NODE_ENV !== 'production')
2019-04-03 00:25:12 +02:00
module.exports = {
2020-06-24 15:26:52 +02:00
telemetry: false,
2021-02-09 12:17:39 +01:00
modern: (process.env.NODE_ENV === 'production') && 'client',
2019-04-03 00:25:12 +02:00
/*
** Headers of the page
*/
head: {
meta: [
{ charset: 'utf-8' },
2019-09-11 19:12:24 +02:00
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
2019-04-03 00:25:12 +02:00
],
script: [{ src: '/gancio-events.es.js', async: true, body: true }],
2019-04-03 00:25:12 +02:00
},
dev: isDev,
2021-10-18 12:48:45 +02:00
server: config.server,
2019-04-03 00:25:12 +02:00
2021-12-02 10:47:37 +01:00
vue: {
config: {
2022-01-26 09:51:42 +01:00
ignoredElements: ['gancio-events', 'gancio-event']
2021-12-02 10:47:37 +01:00
}
},
2022-05-03 15:23:55 +02:00
css: ['./assets/style.css'],
2019-04-03 00:25:12 +02:00
/*
2021-10-18 12:48:45 +02:00
** Customize the progress-bar component
2019-04-03 00:25:12 +02:00
*/
loading: '~/components/Loading.vue',
2019-04-03 00:25:12 +02:00
/*
** Plugins to load before mounting the App
*/
2019-05-30 12:04:14 +02:00
plugins: [
2020-07-25 21:41:22 +02:00
'@/plugins/filters', // text filters, datetime filters, generic transformation helpers etc.
2019-06-25 01:05:38 +02:00
'@/plugins/axios', // axios baseurl configuration
2020-09-05 01:21:47 +02:00
'@/plugins/validators', // inject validators
2020-12-04 17:29:43 +01:00
'@/plugins/api', // api helpers
{ src: '@/plugins/v-calendar', ssr: false } // v-calendar
2019-05-30 12:04:14 +02:00
],
2019-11-13 17:57:37 +01:00
2019-04-03 00:25:12 +02:00
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'nuxt-i18n',
2021-10-21 20:49:49 +02:00
'@nuxtjs/axios',
'@nuxtjs/auth',
'@nuxtjs/sitemap'
2019-04-03 00:25:12 +02:00
],
2021-02-09 12:17:39 +01:00
2022-05-26 11:10:40 +02:00
sitemap: {
hostname: config.baseurl,
gzip: true,
exclude: [
'/Admin',
'/settings',
'/export',
'/setup'
],
routes: async () => {
if (config.status === 'READY') {
try {
const Event = require('./server/api/models/event')
const events = await Event.findAll({ where: { is_visible: true } })
return events.map(e => `/event/${e.slug}`)
} catch (e) {
return []
}
2022-06-19 23:52:10 +02:00
} else {
return []
2022-05-26 11:10:40 +02:00
}
}
},
i18n: {
locales: Object.keys(locales).map(key => ({
code: key,
name: locales[key],
file: `${key}.json`,
iso: key
})),
vueI18n: {
fallbackLocale: 'en'
},
langDir: 'locales',
lazy: true,
strategy: 'no_prefix',
baseUrl: config.baseurl,
skipSettingLocaleOnNavigate: true,
skipNuxtState: true
},
2022-05-26 11:10:40 +02:00
serverMiddleware: ['server/routes'],
2019-04-03 00:25:12 +02:00
/*
** Axios module configuration
* See https://github.com/nuxt-community/axios-module#options
2019-04-03 00:25:12 +02:00
*/
axios: {
2019-06-07 17:02:33 +02:00
prefix: '/api'
2019-04-03 00:25:12 +02:00
},
2019-04-26 23:14:43 +02:00
auth: {
2022-10-31 17:04:31 +01:00
rewriteRedirects: true,
fullPathRedirect: true,
2020-01-27 00:47:03 +01:00
// localStorage: false, // https://github.com/nuxt-community/auth-module/issues/425
cookie: {
prefix: 'auth.',
2020-02-01 22:39:31 +01:00
options: {
maxAge: 60 * 60 * 24 * 30 * 12 * 5
}
2020-01-27 00:47:03 +01:00
},
2019-04-26 23:14:43 +02:00
strategies: {
local: {
endpoints: {
2020-01-27 00:47:03 +01:00
login: {
url: '../oauth/login',
method: 'post',
propertyName: 'access_token',
withCredentials: true,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
},
2019-05-30 12:04:14 +02:00
logout: false,
2022-11-04 12:22:21 +01:00
user: { url: '/user', method: 'get', propertyName: false, autoFetch: false }
2019-07-23 01:31:43 +02:00
},
tokenRequired: true,
2019-07-23 01:31:43 +02:00
tokenType: 'Bearer'
2019-04-26 23:14:43 +02:00
}
}
},
buildModules: ['@nuxtjs/vuetify'],
vuetify: {
treeShake: true,
theme: {
options: {
customProperties: false,
variations: false,
minifyTheme,
},
dark: true,
themes: {
dark: {
primary: '#FF6E40'
},
light: {
primary: '#FF4500'
}
}
},
defaultAssets: false
},
build: {
extend(config, { isDev, isClient }) {
// ..
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
})
// Sets webpack's mode to development if `isDev` is true.
if (isDev) {
config.mode = 'development'
}
},
corejs: 3,
cache: true,
hardSource: !isDev,
extractCSS: !isDev,
optimizeCSS: !isDev
2020-07-25 21:41:22 +02:00
},
2019-04-03 00:25:12 +02:00
}