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