nuxt.config.ts 5.2 KB

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