nuxt.config.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. webfontloader: {
  99. google: {
  100. families: ["Barlow:300,400,500,700&display=swap"],
  101. },
  102. },
  103. devtools: {
  104. // @see https://github.com/nuxt/devtools
  105. enabled: true,
  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. noExternal: ["vuetify"],
  118. },
  119. server: {
  120. https,
  121. //@ts-ignore
  122. port: 443,
  123. hmr: {
  124. protocol: "wss",
  125. port: 24680
  126. },
  127. },
  128. },
  129. vuetify: {
  130. styles: { configFile: "src/vuetify.scss" },
  131. },
  132. i18n: {
  133. langDir: "lang",
  134. lazy: true,
  135. locales: [
  136. {
  137. code: "fr",
  138. iso: "fr-FR",
  139. file: "fr.json",
  140. name: "Français",
  141. },
  142. ],
  143. defaultLocale: "fr",
  144. detectBrowserLanguage: false,
  145. } as NuxtI18nOptions,
  146. build: {
  147. transpile: transpile,
  148. },
  149. });