nuxt.config.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. import languages from "./languages"
  2. require("dotenv").config()
  3. // Common options
  4. export const options = {
  5. name: "Hoppscotch",
  6. shortDescription: "Open source API development ecosystem",
  7. description:
  8. "Helps you create requests faster, saving precious time on development.",
  9. keywords:
  10. "hoppscotch, hopp scotch, hoppscotch online, hoppscotch app, postwoman, postwoman chrome, postwoman online, postwoman for mac, postwoman app, postwoman for windows, postwoman google chrome, postwoman chrome app, get postwoman, postwoman web, postwoman android, postwoman app for chrome, postwoman mobile app, postwoman web app, api, request, testing, tool, rest, websocket, sse, graphql, socketio",
  11. loading: {
  12. color: "var(--accent-color)",
  13. background: "var(--primary-color)",
  14. },
  15. app: {
  16. background: "#202124",
  17. },
  18. social: {
  19. twitter: "@hoppscotch_io",
  20. },
  21. }
  22. export default {
  23. // Disable server-side rendering (https://go.nuxtjs.dev/ssr-mode)
  24. ssr: false,
  25. // Target (https://go.nuxtjs.dev/config-target)
  26. target: "static",
  27. // Default: localhost
  28. server: {
  29. host: "0.0.0.0",
  30. },
  31. // Global page headers (https://go.nuxtjs.dev/config-head)
  32. head: {
  33. meta: [
  34. {
  35. name: "keywords",
  36. content: options.keywords,
  37. },
  38. {
  39. name: "X-UA-Compatible",
  40. content: "IE=edge, chrome=1",
  41. },
  42. {
  43. itemprop: "name",
  44. content: `${options.name} • ${options.shortDescription}`,
  45. },
  46. {
  47. itemprop: "description",
  48. content: options.description,
  49. },
  50. {
  51. itemprop: "image",
  52. content: `${process.env.BASE_URL}/banner.png`,
  53. },
  54. // Add to homescreen for Chrome on Android. Fallback for PWA (handled by nuxt)
  55. {
  56. name: "application-name",
  57. content: options.name,
  58. },
  59. // Windows phone tile icon
  60. {
  61. name: "msapplication-TileImage",
  62. content: `/icon.png`,
  63. },
  64. {
  65. name: "msapplication-TileColor",
  66. content: options.app.background,
  67. },
  68. {
  69. name: "msapplication-tap-highlight",
  70. content: "no",
  71. },
  72. ],
  73. },
  74. // Customize the progress-bar color (https://nuxtjs.org/api/configuration-loading/#customizing-the-progress-bar)
  75. loading: {
  76. color: options.loading.color,
  77. continuous: true,
  78. },
  79. // Customize the loading indicator (https://nuxtjs.org/api/configuration-loading-indicator)
  80. loadingIndicator: {
  81. name: "pulse",
  82. color: options.loading.color,
  83. background: options.loading.background,
  84. },
  85. // Global CSS (https://go.nuxtjs.dev/config-css)
  86. css: ["~/assets/scss/styles.scss", "~/assets/scss/themes.scss"],
  87. // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
  88. plugins: [
  89. "~/plugins/v-tippy",
  90. "~/plugins/v-focus",
  91. "~/plugins/v-textarea",
  92. "~/plugins/vue-apollo",
  93. "~/plugins/crisp",
  94. { src: "~/plugins/web-worker", ssr: false },
  95. ],
  96. // Auto import components (https://go.nuxtjs.dev/config-components)
  97. components: true,
  98. // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  99. buildModules: [
  100. // https://github.com/nuxt-community/pwa-module
  101. "@nuxtjs/pwa",
  102. // https://github.com/nuxt-community/stylelint-module
  103. "@nuxtjs/stylelint-module",
  104. // https://github.com/nuxt-community/analytics-module
  105. "@nuxtjs/google-analytics",
  106. // https://github.com/nuxt-community/gtm-module
  107. "@nuxtjs/gtm",
  108. // https://github.com/windicss/windicss
  109. "nuxt-windicss",
  110. // https://github.com/nuxt-community/color-mode-module
  111. "@nuxtjs/color-mode",
  112. // https://github.com/nuxt-community/svg-module
  113. "@nuxtjs/svg",
  114. // https: //github.com/nuxt-community/google-fonts-module
  115. "@nuxtjs/google-fonts",
  116. // https://github.com/nuxt/typescript
  117. ["@nuxt/typescript-build", { typeCheck: false }],
  118. // https://github.com/nuxt-community/dotenv-module
  119. "@nuxtjs/dotenv",
  120. // https://github.com/nuxt-community/composition-api
  121. "@nuxtjs/composition-api/module",
  122. // https://github.com/antfu/unplugin-vue2-script-setup
  123. "unplugin-vue2-script-setup/nuxt",
  124. ],
  125. // Modules (https://go.nuxtjs.dev/config-modules)
  126. modules: [
  127. // https://github.com/nuxt-community/axios-module
  128. "@nuxtjs/axios",
  129. // https://github.com/Maronato/vue-toastification
  130. "vue-toastification/nuxt",
  131. // https://github.com/nuxt-community/i18n-module
  132. "@nuxtjs/i18n",
  133. // https://github.com/nuxt-community/robots-module
  134. "@nuxtjs/robots",
  135. // https://github.com/nuxt-community/sitemap-module
  136. "@nuxtjs/sitemap",
  137. ],
  138. // PWA module configuration (https://pwa.nuxtjs.org/setup)
  139. pwa: {
  140. meta: {
  141. name: `${options.name} - ${options.shortDescription}`,
  142. description: options.description,
  143. ogHost: process.env.BASE_URL,
  144. ogImage: `${process.env.BASE_URL}/banner.png`,
  145. twitterCard: "summary_large_image",
  146. twitterSite: options.social.twitter,
  147. twitterCreator: options.social.twitter,
  148. theme_color: options.app.background,
  149. },
  150. manifest: {
  151. name: options.name,
  152. short_name: options.name,
  153. description: options.shortDescription,
  154. start_url: "/?source=pwa",
  155. background_color: options.app.background,
  156. },
  157. },
  158. // ESLint module configuration (https://github.com/nuxt-community/eslint-module)
  159. eslint: {
  160. fix: true,
  161. emitWarning: true,
  162. quiet: true,
  163. },
  164. // Toast module configuration (https://github.com/nuxt-community/modules/tree/master/packages/toast)
  165. toast: {
  166. position: "bottom-center",
  167. toastClassName: "toasted-container",
  168. timeout: 3000,
  169. closeOnClick: false,
  170. showCloseButtonOnHover: true,
  171. closeButton: "button",
  172. transition: "Vue-Toastification__fade",
  173. },
  174. // Google Analytics module configuration (https://github.com/nuxt-community/analytics-module)
  175. googleAnalytics: {
  176. id: process.env.GA_ID,
  177. },
  178. // Google Tag Manager module configuration (https://github.com/nuxt-community/gtm-module)
  179. gtm: {
  180. id: process.env.GTM_ID,
  181. },
  182. // Sitemap module configuration (https://github.com/nuxt-community/sitemap-module)
  183. sitemap: {
  184. hostname: process.env.BASE_URL,
  185. },
  186. // Robots module configuration (https://github.com/nuxt-community/robots-module)
  187. robots: {
  188. UserAgent: "*",
  189. Disallow: "",
  190. Allow: "/",
  191. Sitemap: `${process.env.BASE_URL}/sitemap.xml`,
  192. },
  193. // Google Fonts module configuration (https://github.com/nuxt-community/google-fonts-module)
  194. googleFonts: {
  195. display: "block",
  196. families: {
  197. Inter: [400, 500, 600, 700, 800],
  198. "Material+Icons": true,
  199. "Roboto+Mono": [400, 500],
  200. },
  201. },
  202. // i18n module configuration (https://github.com/nuxt-community/i18n-module)
  203. i18n: {
  204. locales: languages,
  205. defaultLocale: "en",
  206. vueI18n: {
  207. fallbackLocale: "en",
  208. },
  209. lazy: true,
  210. langDir: "locales/",
  211. detectBrowserLanguage: {
  212. alwaysRedirect: true,
  213. fallbackLocale: "en",
  214. },
  215. baseUrl: process.env.BASE_URL,
  216. },
  217. // Color mode configuration (https://github.com/nuxt-community/color-mode-module)
  218. colorMode: {
  219. classSuffix: "",
  220. },
  221. // Build Configuration (https://go.nuxtjs.dev/config-build)
  222. build: {
  223. // You can extend webpack config here
  224. extend(config, { isDev, isClient }) {
  225. // Sets webpack's mode to development if `isDev` is true.
  226. if (isDev) {
  227. config.mode = "development"
  228. }
  229. config.node = {
  230. fs: "empty",
  231. }
  232. if (isClient) {
  233. config.module.rules.unshift({
  234. test: /\.worker\.(c|m)?js$/i,
  235. use: { loader: "worker-loader" },
  236. exclude: /(node_modules)/,
  237. })
  238. config.module.rules.push({
  239. test: /\.md$/i,
  240. use: { loader: "raw-loader" },
  241. exclude: /(node_modules)/,
  242. })
  243. config.module.rules.push({
  244. test: /\.geojson$/i,
  245. use: { loader: "json-loader" },
  246. exclude: /(node_modules)/,
  247. })
  248. config.module.rules.push({
  249. test: /\.mjs$/,
  250. include: /node_modules/,
  251. type: "javascript/auto",
  252. })
  253. config.module.rules.push({
  254. test: /\.js$/,
  255. include: /(node_modules)/,
  256. exclude: /(node_modules)\/(ace-builds)|(@firebase)/,
  257. loader: "babel-loader",
  258. options: {
  259. plugins: [
  260. "@babel/plugin-proposal-class-properties",
  261. "@babel/plugin-proposal-nullish-coalescing-operator",
  262. "@babel/plugin-proposal-optional-chaining",
  263. ],
  264. },
  265. })
  266. }
  267. },
  268. parallel: true,
  269. cache: true,
  270. // hardSource: true,
  271. },
  272. // Generate configuration (https://nuxtjs.org/api/configuration-generate)
  273. generate: {
  274. fallback: true,
  275. },
  276. // dotenv configuration (https://github.com/nuxt-community/dotenv-module)
  277. env: {
  278. GA_ID: process.env.GA_ID,
  279. GTM_ID: process.env.GTM_ID,
  280. API_KEY: process.env.API_KEY,
  281. AUTH_DOMAIN: process.env.AUTH_DOMAIN,
  282. DATABASE_URL: process.env.DATABASE_URL,
  283. PROJECT_ID: process.env.PROJECT_ID,
  284. STORAGE_BUCKET: process.env.STORAGE_BUCKET,
  285. MESSAGING_SENDER_ID: process.env.MESSAGING_SENDER_ID,
  286. APP_ID: process.env.APP_ID,
  287. MEASUREMENT_ID: process.env.MEASUREMENT_ID,
  288. BASE_URL: process.env.BASE_URL,
  289. },
  290. // Router configuration (https://nuxtjs.org/api/configuration-router)
  291. router: {
  292. linkActiveClass: "active-link",
  293. linkExactActiveClass: "exact-active-link",
  294. },
  295. }