nuxt.config.ts 3.7 KB

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