nuxt.config.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import fs from 'fs'
  2. import vuetify from 'vite-plugin-vuetify'
  3. import type { NuxtI18nOptions } from '@nuxtjs/i18n'
  4. let https = {}
  5. const transpile = ['vuetify', 'pinia', 'pinia-orm', 'date-fns']
  6. if (!process.env.NUXT_ENV) {
  7. throw new Error('Missing environment file - Run yarn install')
  8. }
  9. if (process.env.NUXT_ENV === 'dev') {
  10. https = {
  11. key: fs.readFileSync('env/local.portail_v2.opentalent.fr.key'),
  12. cert: fs.readFileSync('env/local.portail_v2.opentalent.fr.crt'),
  13. }
  14. } else {
  15. transpile.push('lodash')
  16. }
  17. /**
  18. * Nuxt configuration
  19. *
  20. * @see https://nuxt.com/docs/api/configuration/nuxt-config
  21. */
  22. export default defineNuxtConfig({
  23. ssr: false,
  24. title: 'Opentalent',
  25. runtimeConfig: {
  26. // Private config that is only available on the server
  27. env: '',
  28. apiBaseUrl: '',
  29. agendaBaseUrl: '',
  30. hCaptchaSiteKey: '35360874-ebb1-4748-86e3-9b156d5bfc53',
  31. // Config within public will be also exposed to the client
  32. public: {
  33. env: '',
  34. apiBaseUrl: '',
  35. agendaBaseUrl: '',
  36. hCaptchaSiteKey: '35360874-ebb1-4748-86e3-9b156d5bfc53',
  37. },
  38. },
  39. css: ['~/assets/style/main.scss', '~/assets/style/theme.scss'],
  40. hooks: {
  41. 'builder:watch': console.log,
  42. },
  43. app: {
  44. head: {
  45. title: 'Opentalent',
  46. meta: [
  47. { charset: 'utf-8' },
  48. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  49. { hid: 'description', name: 'description', content: '' },
  50. ],
  51. link: [
  52. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
  53. {
  54. rel: 'stylesheet',
  55. href: 'https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;700&display=swap',
  56. },
  57. ],
  58. },
  59. },
  60. typescript: {
  61. strict: true,
  62. },
  63. modules: [
  64. // eslint-disable-next-line require-await
  65. async (_, nuxt) => {
  66. nuxt.hooks.hook('vite:extendConfig', (config) =>
  67. // @ts-expect-error A revoir après que les lignes aient été décommentées
  68. (config.plugins ?? []).push(
  69. vuetify()
  70. // Remplacer par cela quand l'issue https://github.com/vuetifyjs/vuetify-loader/issues/273 sera règlée..
  71. // voir aussi : https://github.com/nuxt/nuxt/issues/15412 et https://github.com/vuetifyjs/vuetify-loader/issues/290
  72. // voir aussi : https://github.com/jrutila/nuxt3-vuetify3-bug
  73. // vuetify({
  74. // styles: { configFile: './assets/css/settings.scss' }
  75. // })
  76. )
  77. )
  78. },
  79. [
  80. '@pinia/nuxt',
  81. {
  82. autoImports: [
  83. // automatically imports `usePinia()`
  84. 'defineStore',
  85. // automatically imports `usePinia()` as `usePiniaStore()`
  86. ['defineStore', 'definePiniaStore'],
  87. ],
  88. },
  89. ],
  90. '@pinia-orm/nuxt',
  91. 'nuxt-lodash',
  92. '@nuxtjs/i18n',
  93. '@nuxt/devtools',
  94. 'nuxt3-leaflet',
  95. ],
  96. router: {
  97. options: {
  98. scrollBehaviorType: 'smooth',
  99. },
  100. },
  101. webfontloader: {
  102. google: {
  103. families: ['Barlow:300,400,500,700&display=swap'],
  104. },
  105. },
  106. devtools: {
  107. // @see https://github.com/nuxt/devtools
  108. enabled: true,
  109. },
  110. vite: {
  111. esbuild: {
  112. drop: process.env.DEBUG ? [] : ['console', 'debugger'],
  113. tsconfigRaw: {
  114. compilerOptions: {
  115. experimentalDecorators: true,
  116. },
  117. },
  118. },
  119. ssr: {
  120. noExternal: ['vuetify'],
  121. },
  122. server: {
  123. https,
  124. // @ts-ignore
  125. port: 443,
  126. hmr: {
  127. protocol: 'wss',
  128. port: 24680,
  129. },
  130. },
  131. },
  132. vuetify: {
  133. styles: { configFile: 'src/vuetify.scss' },
  134. },
  135. i18n: {
  136. langDir: 'lang',
  137. lazy: true,
  138. locales: [
  139. {
  140. code: 'fr',
  141. iso: 'fr-FR',
  142. file: 'fr.json',
  143. name: 'Français',
  144. },
  145. ],
  146. defaultLocale: 'fr',
  147. detectBrowserLanguage: false,
  148. } as NuxtI18nOptions,
  149. build: {
  150. transpile,
  151. },
  152. })