nuxt.config.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. import fs from "fs";
  2. import vuetify from "vite-plugin-vuetify";
  3. import { 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('local.portail_v2.opentalent.fr.key'),
  12. cert: fs.readFileSync('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: process.env.NUXT_API_BASE_URL,
  29. // Config within public will be also exposed to the client
  30. public: {
  31. env: "",
  32. apiBaseUrl: "",
  33. },
  34. },
  35. css: [
  36. "~/assets/style/main.scss",
  37. "~/assets/style/theme.scss",
  38. ],
  39. hooks: {
  40. "builder:watch": console.log,
  41. },
  42. app: {
  43. head: {
  44. title: "Opentalent",
  45. meta: [
  46. { charset: "utf-8" },
  47. { name: "viewport", content: "width=device-width, initial-scale=1" },
  48. { hid: "description", name: "description", content: "" },
  49. ],
  50. link: [
  51. { rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
  52. {
  53. rel: "stylesheet",
  54. href: "https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;700&display=swap",
  55. },
  56. ],
  57. },
  58. },
  59. typescript: {
  60. strict: true,
  61. },
  62. modules: [
  63. async (options, nuxt) => {
  64. nuxt.hooks.hook(
  65. "vite:extendConfig",
  66. (config) =>
  67. (config.plugins ?? []).push(
  68. vuetify()
  69. //Remplacer par cela quand l'issue https://github.com/vuetifyjs/vuetify-loader/issues/273 sera règlée..
  70. // voir aussi : https://github.com/nuxt/nuxt/issues/15412 et https://github.com/vuetifyjs/vuetify-loader/issues/290
  71. // vuetify({
  72. // styles: { configFile: './assets/css/settings.scss' }
  73. // })
  74. ) as any
  75. );
  76. },
  77. [
  78. "@pinia/nuxt",
  79. {
  80. autoImports: [
  81. // automatically imports `usePinia()`
  82. "defineStore",
  83. // automatically imports `usePinia()` as `usePiniaStore()`
  84. ["defineStore", "definePiniaStore"],
  85. ],
  86. },
  87. ],
  88. "@pinia-orm/nuxt",
  89. "nuxt-lodash",
  90. "@nuxtjs/i18n",
  91. "@nuxt/devtools",
  92. ],
  93. webfontloader: {
  94. google: {
  95. families: ["Barlow:300,400,500,700&display=swap"],
  96. },
  97. },
  98. devtools: {
  99. // @see https://github.com/nuxt/devtools
  100. enabled: false,
  101. },
  102. vite: {
  103. esbuild: {
  104. drop: process.env.DEBUG ? [] : ["console", "debugger"],
  105. },
  106. ssr: {
  107. noExternal: ["vuetify"],
  108. },
  109. server: {
  110. https,
  111. //@ts-ignore
  112. port: 443,
  113. hmr: {
  114. protocol: "wss",
  115. port: 24680
  116. },
  117. },
  118. },
  119. vuetify: {
  120. styles: { configFile: "src/vuetify.scss" },
  121. },
  122. i18n: {
  123. langDir: "lang",
  124. lazy: true,
  125. locales: [
  126. {
  127. code: "fr",
  128. iso: "fr-FR",
  129. file: "fr.json",
  130. name: "Français",
  131. },
  132. ],
  133. defaultLocale: "fr",
  134. detectBrowserLanguage: false,
  135. vueI18n: {
  136. legacy: false,
  137. datetimeFormats: {
  138. "fr-FR": {
  139. short: {
  140. year: "numeric",
  141. month: "numeric",
  142. day: "numeric",
  143. },
  144. long: {
  145. year: "numeric",
  146. month: "numeric",
  147. day: "numeric",
  148. hour: "numeric",
  149. minute: "numeric",
  150. },
  151. },
  152. },
  153. },
  154. } as NuxtI18nOptions,
  155. build: {
  156. transpile: transpile,
  157. },
  158. });