nuxt.config.ts 3.5 KB

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