nuxt.config.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. script: [
  62. // Google Analytics
  63. {
  64. src: 'https://www.googletagmanager.com/gtag/js?id=G-L8PZ9TEFNX',
  65. async: true
  66. },
  67. {
  68. innerHTML: `
  69. window.dataLayer = window.dataLayer || [];
  70. function gtag(){dataLayer.push(arguments);}
  71. gtag('js', new Date());
  72. gtag('config', 'G-L8PZ9TEFNX');
  73. `,
  74. type: 'text/javascript'
  75. },
  76. // Meta Pixel
  77. {
  78. src: 'https://connect.facebook.net/en_US/fbevents.js',
  79. async: true
  80. },
  81. {
  82. innerHTML: `
  83. !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  84. n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
  85. n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
  86. t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
  87. document,'script','https://connect.facebook.net/en_US/fbevents.js');
  88. fbq('init', '1045498113172655');
  89. fbq('track', 'PageView');
  90. `,
  91. type: 'text/javascript'
  92. }
  93. ],
  94. },
  95. },
  96. typescript: {
  97. strict: true,
  98. },
  99. modules: [
  100. async (options, nuxt) => {
  101. nuxt.hooks.hook(
  102. "vite:extendConfig",
  103. (config) =>
  104. (config.plugins ?? []).push(
  105. vuetify()
  106. //Remplacer par cela quand l'issue https://github.com/vuetifyjs/vuetify-loader/issues/273 sera règlée..
  107. // voir aussi : https://github.com/nuxt/nuxt/issues/15412 et https://github.com/vuetifyjs/vuetify-loader/issues/290
  108. // vuetify({
  109. // styles: { configFile: './assets/css/settings.scss' }
  110. // })
  111. ) as any
  112. );
  113. },
  114. [
  115. "@pinia/nuxt",
  116. {
  117. autoImports: [
  118. // automatically imports `usePinia()`
  119. "defineStore",
  120. // automatically imports `usePinia()` as `usePiniaStore()`
  121. ["defineStore", "definePiniaStore"],
  122. ],
  123. },
  124. ],
  125. "@pinia-orm/nuxt",
  126. "nuxt-lodash",
  127. "@nuxtjs/i18n",
  128. "@nuxt/devtools",
  129. 'nuxt3-leaflet'
  130. ],
  131. router: {
  132. options: {
  133. scrollBehaviorType: 'smooth'
  134. }
  135. },
  136. webfontloader: {
  137. google: {
  138. families: ["Barlow:300,400,500,700&display=swap"],
  139. },
  140. },
  141. devtools: {
  142. // @see https://github.com/nuxt/devtools
  143. enabled: true,
  144. },
  145. vite: {
  146. esbuild: {
  147. drop: process.env.DEBUG ? [] : ["console", "debugger"],
  148. tsconfigRaw: {
  149. compilerOptions: {
  150. experimentalDecorators: true,
  151. }
  152. }
  153. },
  154. ssr: {
  155. noExternal: ["vuetify"],
  156. },
  157. server: {
  158. https,
  159. //@ts-ignore
  160. port: 443,
  161. hmr: {
  162. protocol: "wss",
  163. port: 24680
  164. },
  165. },
  166. },
  167. vuetify: {
  168. styles: { configFile: "src/vuetify.scss" },
  169. },
  170. i18n: {
  171. langDir: "lang",
  172. lazy: true,
  173. locales: [
  174. {
  175. code: "fr",
  176. iso: "fr-FR",
  177. file: "fr.json",
  178. name: "Français",
  179. },
  180. ],
  181. defaultLocale: "fr",
  182. detectBrowserLanguage: false,
  183. } as NuxtI18nOptions,
  184. build: {
  185. transpile: transpile,
  186. },
  187. });