Skip to content

Commit

Permalink
chore: clean nuxt.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Jan 15, 2024
1 parent 905cbb5 commit e38c89a
Showing 1 changed file with 75 additions and 110 deletions.
185 changes: 75 additions & 110 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,62 @@ import vuetify from 'vite-plugin-vuetify'
import { vidos } from './lib/config'
import { configuredApi, configuredImageProxy } from './utils/vido-config-static'

// Build Configuration (https://nuxt.com/docs/api/nuxt-config)
export default defineNuxtConfig({
runtimeConfig: {
public: {
// @ts-ignore
vidos: vidos.__publicRuntimeConfig__ ? vidos : undefined,
cypress: process.env.CYPRESS,
},
build: {
transpile: [
process.env.NODE_ENV === 'production' ? 'maplibre-gl' : '',
'iron-webcrypto',
'punycode',
'pinia',
'vuetify',
'date-fns',
/lodash.*/,
'@fortawesome/vue-fontawesome',
],
},
buildModules: ['@nuxtjs/stylelint-module'],
components: false,
css: ['@fortawesome/fontawesome-svg-core/styles.css'],
gtm: {
pageTracking: false,
},

// Global page headers (https://go.nuxtjs.dev/config-head)
head: {
htmlAttrs: {
lang: 'fr',
},
title: '@teritorio/vido',
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
title: '@teritorio/vido',
},

router: {
// prefetchLinks: false,
i18n: {
defaultLocale: 'en',
detectBrowserLanguage: {
useCookie: false,
},
langDir: 'locales/',
locales: [
{ code: 'en', name: 'English', flag: 'GB', iso: 'en-US', file: 'en.js' },
{ code: 'es', name: 'Español', flag: 'ES', iso: 'es-ES', file: 'es.js' },
{ code: 'fr', name: 'Français', flag: 'FR', iso: 'fr-FR', file: 'fr.js' },
],
strategy: 'no_prefix',
},

// @ts-ignore
loadingIndicator: false,

// Global CSS (https://go.nuxtjs.dev/config-css)
css: ['@fortawesome/fontawesome-svg-core/styles.css'],

purgeCSS: {
whitelistPatterns: [/svg.*/, /fa.*/],
image: {
domains: [...configuredApi(vidos), ...configuredImageProxy(vidos)],
},

// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
plugins: [
'@/plugins/vido-config.ts',
'@/plugins/settings.ts',
'@/plugins/fontawesome.ts',
'@/plugins/touch.ts',
'@/plugins/device.ts',
{ src: '@/plugins/tracking.ts', mode: 'client' },
'@/plugins/property-translations.ts',
{ src: '@/plugins/pinia-shared-state.ts', mode: 'client' },
],

imports: {
autoImport: false,
},

components: false,

// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
buildModules: [
// https://go.nuxtjs.dev/stylelint
'@nuxtjs/stylelint-module',
],

// Modules (https://go.nuxtjs.dev/config-modules)
loadingIndicator: false,
modules: [
'@nuxtjs/i18n',
'@nuxt/image-edge',
...(process.env.SENTRY_DSN ? ['@nuxtjs/sentry'] : []),
// process.env.SENTRY_DSN ? ['@nuxtjs/sentry'] : [],
'@pinia/nuxt',
async (options, nuxt) => {
nuxt.hooks.hook('vite:extendConfig', (config) =>
Expand All @@ -78,34 +68,48 @@ export default defineNuxtConfig({
)
},
],

i18n: {
strategy: 'no_prefix',
// lazy: true, // lazy-load not working as expected https://i18n.nuxtjs.org/lazy-load-translations/
detectBrowserLanguage: {
useCookie: false,
runtimeConfig: {
public: {
// @ts-ignore
vidos: vidos.__publicRuntimeConfig__ ? vidos : undefined,
cypress: process.env.CYPRESS,
},
locales: [
{ code: 'en', name: 'English', flag: 'GB', iso: 'en-US', file: 'en.js' },
{ code: 'es', name: 'Español', flag: 'ES', iso: 'es-ES', file: 'es.js' },
{ code: 'fr', name: 'Français', flag: 'FR', iso: 'fr-FR', file: 'fr.js' },
],
defaultLocale: 'en',
langDir: 'locales/',
},

image: {
domains: [...configuredApi(vidos), ...configuredImageProxy(vidos)],
},

sentry: {
dsn: process.env.SENTRY_DSN || '',
// https://sentry.nuxtjs.org/sentry/options
config: {
// https://docs.sentry.io/platforms/javascript/guides/vue/configuration/options/
plugins: [
'@/plugins/vido-config.ts',
'@/plugins/settings.ts',
'@/plugins/fontawesome.ts',
'@/plugins/touch.ts',
'@/plugins/device.ts',
{ src: '@/plugins/tracking.ts', mode: 'client' },
'@/plugins/property-translations.ts',
{ src: '@/plugins/pinia-shared-state.ts', mode: 'client' },
],
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},

purgeCSS: {
whitelistPatterns: [/svg.*/, /fa.*/],
},
// sentry: {
// dsn: process.env.SENTRY_DSN || '',
// // https://sentry.nuxtjs.org/sentry/options
// config: {
// // https://docs.sentry.io/platforms/javascript/guides/vue/configuration/options/
// },
// },
server: {
host: '0.0.0.0',
},
typescript: {
shim: false
},
vite: {
optimizeDeps: { exclude: ['fsevents'] },
},
watchers: {
chokidar: {
// @ts-ignore
Expand All @@ -122,44 +126,5 @@ export default defineNuxtConfig({
// @ts-ignore
ignored: /\.git|\.yarn|cypress|.*\.story\.vue$|\.nuxt\/dist\/server\//,
},
},

// Build Configuration (https://nuxt.com/docs/api/nuxt-config#build)
build: {
transpile: [
process.env.NODE_ENV === 'production' ? 'maplibre-gl' : '',
'iron-webcrypto',
'punycode',
'pinia',
'vuetify',
'date-fns',
/lodash.*/,
'@fortawesome/vue-fontawesome',
],
},

typescript: {
// typeCheck: !!process.env.TYPESCRIPT_CHECK,
},

postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},

vite: {
optimizeDeps: { exclude: ['fsevents'] },
},

// Server config (allow listening to local network)
server: {
host: '0.0.0.0',
},

// Google Tag Manager config
gtm: {
pageTracking: false,
},
}
})

0 comments on commit e38c89a

Please sign in to comment.