nuxt.config.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import fs from 'fs';
  2. import vuetify from 'vite-plugin-vuetify'
  3. let https = {}
  4. if (process.env.NUXT_ENV === 'dev') {
  5. https = {
  6. key: fs.readFileSync('local.app-v3.opentalent.fr.key'),
  7. cert: fs.readFileSync('local.app-v3.opentalent.fr.crt'),
  8. }
  9. }
  10. /**
  11. * Nuxt configuration
  12. *
  13. * @see https://nuxt.com/docs/api/configuration/nuxt-config
  14. */
  15. export default defineNuxtConfig({
  16. ssr: true,
  17. experimental: {
  18. // Fix the 'Cannot stringify non POJO' bug
  19. // @see https://github.com/nuxt/nuxt/issues/20787
  20. renderJsonPayloads: false
  21. },
  22. runtimeConfig: {
  23. // Private config that is only available on the server
  24. env: '',
  25. baseUrl: '',
  26. baseUrlLegacy: '',
  27. baseUrlAdminLegacy: '',
  28. baseUrlTypo3: '',
  29. baseUrlMercure: '',
  30. supportUrl: '',
  31. // Config within public will be also exposed to the client
  32. public: {
  33. env: '',
  34. baseUrl: '',
  35. baseUrlLegacy: '',
  36. baseUrlAdminLegacy: '',
  37. baseUrlTypo3: '',
  38. baseUrlMercure: '',
  39. supportUrl: '',
  40. }
  41. },
  42. hooks: {
  43. 'builder:watch': console.log,
  44. },
  45. app: {
  46. head: {
  47. title: 'Opentalent',
  48. meta: [
  49. { charset: 'utf-8' },
  50. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  51. { name: 'msapplication-TileColor', content: '#324250' },
  52. { name: 'msapplication-TileImage', content: '/favicon/mstile-144x144.png' }
  53. ],
  54. link: [
  55. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
  56. { rel: 'apple-touch-icon-precomposed', sizes: '57x57', href: '/favicon/apple-touch-icon-57x57.png' },
  57. { rel: 'apple-touch-icon-precomposed', sizes: '114x114', href: '/favicon/apple-touch-icon-114x114.png' },
  58. { rel: 'apple-touch-icon-precomposed', sizes: '72x72', href: '/favicon/apple-touch-icon-72x72.png' },
  59. { rel: 'apple-touch-icon-precomposed', sizes: '144x144', href: '/favicon/apple-touch-icon-144x144.png' },
  60. { rel: 'apple-touch-icon-precomposed', sizes: '120x120', href: '/favicon/apple-touch-icon-120x120.png' },
  61. { rel: 'apple-touch-icon-precomposed', sizes: '152x152', href: '/favicon/apple-touch-icon-152x152.png' },
  62. { rel: 'icon', sizes: '32x32', type: 'image/x-icon', href: '/favicon/favicon-32x32.png' },
  63. { rel: 'icon', sizes: '16x16', type: 'image/x-icon', href: '/favicon/favicon-16x16.png' },
  64. ]
  65. }
  66. },
  67. css: [
  68. '@/assets/css/global.scss',
  69. '@/assets/css/theme.scss',
  70. '@/assets/css/import.scss',
  71. '@vuepic/vue-datepicker/dist/main.css'
  72. ],
  73. typescript: {
  74. strict: true
  75. },
  76. modules: [
  77. async (options, nuxt) => {
  78. nuxt.hooks.hook('vite:extendConfig', config => (config.plugins ?? []).push(
  79. vuetify()
  80. //Remplacer par cela quand l'issue https://github.com/vuetifyjs/vuetify-loader/issues/273 sera règlée..
  81. // voir aussi : https://github.com/nuxt/nuxt/issues/15412 et https://github.com/vuetifyjs/vuetify-loader/issues/290
  82. // voir aussi : https://github.com/jrutila/nuxt3-vuetify3-bug
  83. // vuetify({
  84. // styles: { configFile: './assets/css/settings.scss' }
  85. // })
  86. ) as any );
  87. },
  88. [
  89. '@pinia/nuxt',
  90. {
  91. autoImports: [
  92. // automatically imports `usePinia()`
  93. 'defineStore',
  94. // automatically imports `usePinia()` as `usePiniaStore()`
  95. ['defineStore', 'definePiniaStore'],
  96. ],
  97. }
  98. ],
  99. '@pinia-orm/nuxt',
  100. '@nuxtjs/i18n',
  101. '@nuxt/devtools',
  102. '@nuxt/image'
  103. ],
  104. vite: {
  105. esbuild: {
  106. drop: process.env.DEBUG ? [] : ['console', 'debugger'],
  107. },
  108. ssr: {
  109. // with ssr enabled, this config is required to load vuetify properly
  110. noExternal: ['vuetify']
  111. },
  112. server : {
  113. https,
  114. //@ts-ignore
  115. port: 443,
  116. hmr: {
  117. protocol: 'wss',
  118. port: 24678
  119. }
  120. }
  121. },
  122. // Hide the sourcemaps warnings with vuetify
  123. // @see https://github.com/vuetifyjs/vuetify-loader/issues/290#issuecomment-1435702713
  124. sourcemap: {
  125. server: false,
  126. client: false,
  127. },
  128. i18n: {
  129. langDir: 'lang',
  130. lazy: true,
  131. locales: [
  132. {
  133. code: 'en',
  134. iso: 'en-US',
  135. file: 'en.json',
  136. name: 'English'
  137. },
  138. {
  139. code: 'fr',
  140. iso: 'fr-FR',
  141. file: 'fr.json',
  142. name: 'Français'
  143. }
  144. ],
  145. defaultLocale: 'fr',
  146. detectBrowserLanguage: false,
  147. vueI18n: './i18n.config.ts'
  148. },
  149. image: {
  150. provider: 'none'
  151. },
  152. build: {
  153. transpile: ['vuetify', '@vuepic/vue-datepicker', 'pinia', 'pinia-orm', 'date-fns'],
  154. }
  155. })