nuxt.config.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import fs from "fs";
  2. import vuetify from "vite-plugin-vuetify";
  3. import type { NuxtI18nOptions } from "@nuxtjs/i18n";
  4. let https = {}
  5. let transpile = ['vuetify', 'pinia', 'pinia-orm', 'date-fns']
  6. if (!process.env.NUXT_ENV) {
  7. throw Error('Missing environment file - Run yarn install')
  8. }
  9. if (process.env.NUXT_ENV === 'dev') {
  10. https = {
  11. key: fs.readFileSync('env/local.portail_v2.opentalent.fr.key'),
  12. cert: fs.readFileSync('env/local.portail_v2.opentalent.fr.crt'),
  13. }
  14. } else {
  15. transpile.push('lodash')
  16. }
  17. /**
  18. * Nuxt configuration
  19. *
  20. * @see https://nuxt.com/docs/api/configuration/nuxt-config
  21. */
  22. export default defineNuxtConfig({
  23. ssr: false,
  24. title: "Opentalent",
  25. runtimeConfig: {
  26. // Private config that is only available on the server
  27. env: "",
  28. apiBaseUrl: "",
  29. agendaBaseUrl: "",
  30. hCaptchaSiteKey: "35360874-ebb1-4748-86e3-9b156d5bfc53",
  31. // Config within public will be also exposed to the client
  32. public: {
  33. env: "",
  34. apiBaseUrl: "",
  35. agendaBaseUrl: "",
  36. hCaptchaSiteKey: "35360874-ebb1-4748-86e3-9b156d5bfc53",
  37. },
  38. },
  39. css: [
  40. "~/assets/style/main.scss",
  41. "~/assets/style/theme.scss",
  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. { hid: "description", name: "description", content: "" },
  53. ],
  54. link: [
  55. { rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
  56. {
  57. rel: "stylesheet",
  58. href: "https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;700&display=swap",
  59. },
  60. ],
  61. },
  62. },
  63. typescript: {
  64. strict: true,
  65. },
  66. modules: [
  67. async (options, nuxt) => {
  68. nuxt.hooks.hook(
  69. "vite:extendConfig",
  70. (config) =>
  71. (config.plugins ?? []).push(
  72. vuetify()
  73. //Remplacer par cela quand l'issue https://github.com/vuetifyjs/vuetify-loader/issues/273 sera règlée..
  74. // voir aussi : https://github.com/nuxt/nuxt/issues/15412 et https://github.com/vuetifyjs/vuetify-loader/issues/290
  75. // vuetify({
  76. // styles: { configFile: './assets/css/settings.scss' }
  77. // })
  78. ) as any
  79. );
  80. },
  81. [
  82. "@pinia/nuxt",
  83. {
  84. autoImports: [
  85. // automatically imports `usePinia()`
  86. "defineStore",
  87. // automatically imports `usePinia()` as `usePiniaStore()`
  88. ["defineStore", "definePiniaStore"],
  89. ],
  90. },
  91. ],
  92. "@pinia-orm/nuxt",
  93. "nuxt-lodash",
  94. "@nuxtjs/i18n",
  95. "@nuxt/devtools",
  96. 'nuxt3-leaflet'
  97. ],
  98. router: {
  99. options: {
  100. scrollBehaviorType: 'smooth'
  101. }
  102. },
  103. webfontloader: {
  104. google: {
  105. families: ["Barlow:300,400,500,700&display=swap"],
  106. },
  107. },
  108. devtools: {
  109. // @see https://github.com/nuxt/devtools
  110. enabled: true,
  111. },
  112. vite: {
  113. esbuild: {
  114. drop: process.env.DEBUG ? [] : ["console", "debugger"],
  115. tsconfigRaw: {
  116. compilerOptions: {
  117. experimentalDecorators: true,
  118. }
  119. }
  120. },
  121. ssr: {
  122. noExternal: ["vuetify"],
  123. },
  124. server: {
  125. https,
  126. //@ts-ignore
  127. port: 443,
  128. hmr: {
  129. protocol: "wss",
  130. port: 24680
  131. },
  132. },
  133. },
  134. vuetify: {
  135. styles: { configFile: "src/vuetify.scss" },
  136. },
  137. i18n: {
  138. langDir: "lang",
  139. lazy: true,
  140. locales: [
  141. {
  142. code: "fr",
  143. iso: "fr-FR",
  144. file: "fr.json",
  145. name: "Français",
  146. },
  147. ],
  148. defaultLocale: "fr",
  149. detectBrowserLanguage: false,
  150. } as NuxtI18nOptions,
  151. build: {
  152. transpile: transpile,
  153. },
  154. });