nuxt.config.ts 5.4 KB

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