nuxt.config.ts 5.5 KB

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