nuxt.config.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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/init-fb.ts",
  94. "~/plugins/crisp",
  95. { src: "~/plugins/web-worker", ssr: false },
  96. ],
  97. // Auto import components (https://go.nuxtjs.dev/config-components)
  98. components: true,
  99. // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  100. buildModules: [
  101. // https://github.com/nuxt-community/pwa-module
  102. "@nuxtjs/pwa",
  103. // https://github.com/nuxt-community/stylelint-module
  104. "@nuxtjs/stylelint-module",
  105. // https://github.com/nuxt-community/eslint-module
  106. "@nuxtjs/eslint-module",
  107. // https://github.com/nuxt-community/analytics-module
  108. "@nuxtjs/google-analytics",
  109. // https://github.com/nuxt-community/gtm-module
  110. "@nuxtjs/gtm",
  111. // https://github.com/windicss/windicss
  112. "nuxt-windicss",
  113. // https://github.com/nuxt-community/color-mode-module
  114. "@nuxtjs/color-mode",
  115. // https://github.com/nuxt-community/svg-module
  116. "@nuxtjs/svg",
  117. // https: //github.com/nuxt-community/google-fonts-module
  118. "@nuxtjs/google-fonts",
  119. // https://github.com/nuxt/typescript
  120. ["@nuxt/typescript-build", { typeCheck: false }],
  121. // https://github.com/nuxt-community/dotenv-module
  122. "@nuxtjs/dotenv",
  123. // https://github.com/nuxt-community/composition-api
  124. "@nuxtjs/composition-api/module",
  125. "~/modules/emit-volar-types.ts",
  126. ],
  127. // Modules (https://go.nuxtjs.dev/config-modules)
  128. modules: [
  129. // https://github.com/nuxt-community/axios-module
  130. "@nuxtjs/axios",
  131. // https://github.com/nuxt-community/modules/tree/master/packages/toast
  132. "@nuxtjs/toast",
  133. // https://github.com/nuxt-community/i18n-module
  134. "@nuxtjs/i18n",
  135. // https://github.com/nuxt-community/robots-module
  136. "@nuxtjs/robots",
  137. // https://github.com/nuxt-community/sitemap-module
  138. "@nuxtjs/sitemap",
  139. ],
  140. // PWA module configuration (https://pwa.nuxtjs.org/setup)
  141. pwa: {
  142. meta: {
  143. name: `${options.name} - ${options.shortDescription}`,
  144. description: options.description,
  145. ogHost: process.env.BASE_URL,
  146. ogImage: `${process.env.BASE_URL}/banner.png`,
  147. twitterCard: "summary_large_image",
  148. twitterSite: options.social.twitter,
  149. twitterCreator: options.social.twitter,
  150. theme_color: options.app.background,
  151. },
  152. manifest: {
  153. name: options.name,
  154. short_name: options.name,
  155. description: options.shortDescription,
  156. start_url: "/?source=pwa",
  157. background_color: options.app.background,
  158. },
  159. },
  160. // ESLint module configuration (https://github.com/nuxt-community/eslint-module)
  161. eslint: {
  162. fix: true,
  163. emitWarning: true,
  164. quiet: true,
  165. },
  166. // Toast module configuration (https://github.com/nuxt-community/modules/tree/master/packages/toast)
  167. toast: {
  168. position: "bottom-center",
  169. duration: 3000,
  170. keepOnHover: true,
  171. // singleton: true,
  172. },
  173. // Google Analytics module configuration (https://github.com/nuxt-community/analytics-module)
  174. googleAnalytics: {
  175. id: process.env.GA_ID,
  176. },
  177. // Google Tag Manager module configuration (https://github.com/nuxt-community/gtm-module)
  178. gtm: {
  179. id: process.env.GTM_ID,
  180. },
  181. // Sitemap module configuration (https://github.com/nuxt-community/sitemap-module)
  182. sitemap: {
  183. hostname: process.env.BASE_URL,
  184. },
  185. // Robots module configuration (https://github.com/nuxt-community/robots-module)
  186. robots: {
  187. UserAgent: "*",
  188. Disallow: "",
  189. Allow: "/",
  190. Sitemap: `${process.env.BASE_URL}/sitemap.xml`,
  191. },
  192. // Google Fonts module configuration (https://github.com/nuxt-community/google-fonts-module)
  193. googleFonts: {
  194. display: "block",
  195. families: {
  196. Inter: [400, 500, 600, 700, 800],
  197. "Material+Icons": true,
  198. "Roboto+Mono": [400, 500],
  199. },
  200. },
  201. // i18n module configuration (https://github.com/nuxt-community/i18n-module)
  202. i18n: {
  203. locales: languages,
  204. defaultLocale: "en",
  205. vueI18n: {
  206. fallbackLocale: "en",
  207. },
  208. lazy: true,
  209. langDir: "locales/",
  210. detectBrowserLanguage: {
  211. alwaysRedirect: true,
  212. fallbackLocale: "en",
  213. },
  214. baseUrl: process.env.BASE_URL,
  215. },
  216. // Color mode configuration (https://github.com/nuxt-community/color-mode-module)
  217. colorMode: {
  218. classSuffix: "",
  219. },
  220. // Build Configuration (https://go.nuxtjs.dev/config-build)
  221. build: {
  222. // You can extend webpack config here
  223. extend(config, { isDev, isClient }) {
  224. // Sets webpack's mode to development if `isDev` is true.
  225. if (isDev) {
  226. config.mode = "development"
  227. }
  228. config.node = {
  229. fs: "empty",
  230. }
  231. if (isClient) {
  232. config.module.rules.unshift({
  233. test: /\.worker\.(c|m)?js$/i,
  234. use: { loader: "worker-loader" },
  235. exclude: /(node_modules)/,
  236. })
  237. config.module.rules.push({
  238. test: /\.md$/i,
  239. use: { loader: "raw-loader" },
  240. exclude: /(node_modules)/,
  241. })
  242. config.module.rules.push({
  243. test: /\.geojson$/i,
  244. use: { loader: "json-loader" },
  245. exclude: /(node_modules)/,
  246. })
  247. config.module.rules.push({
  248. test: /\.mjs$/,
  249. include: /node_modules/,
  250. type: "javascript/auto",
  251. })
  252. config.module.rules.push({
  253. test: /\.js$/,
  254. include: /(node_modules)/,
  255. exclude: /(node_modules)\/(@firebase)/,
  256. loader: "babel-loader",
  257. options: {
  258. plugins: [
  259. "@babel/plugin-proposal-class-properties",
  260. "@babel/plugin-proposal-nullish-coalescing-operator",
  261. "@babel/plugin-proposal-optional-chaining",
  262. ],
  263. },
  264. })
  265. }
  266. },
  267. parallel: true,
  268. cache: true,
  269. // hardSource: true,
  270. terser: {
  271. terserOptions: {
  272. // https://github.com/terser/terser#compress-options
  273. compress: {
  274. pure_funcs: ["console.log", "console.debug", "console.warn"],
  275. },
  276. },
  277. },
  278. },
  279. // Generate configuration (https://nuxtjs.org/api/configuration-generate)
  280. generate: {
  281. fallback: true,
  282. },
  283. // dotenv configuration (https://github.com/nuxt-community/dotenv-module)
  284. env: {
  285. GA_ID: process.env.GA_ID,
  286. GTM_ID: process.env.GTM_ID,
  287. API_KEY: process.env.API_KEY,
  288. AUTH_DOMAIN: process.env.AUTH_DOMAIN,
  289. DATABASE_URL: process.env.DATABASE_URL,
  290. PROJECT_ID: process.env.PROJECT_ID,
  291. STORAGE_BUCKET: process.env.STORAGE_BUCKET,
  292. MESSAGING_SENDER_ID: process.env.MESSAGING_SENDER_ID,
  293. APP_ID: process.env.APP_ID,
  294. MEASUREMENT_ID: process.env.MEASUREMENT_ID,
  295. BASE_URL: process.env.BASE_URL,
  296. },
  297. // Router configuration (https://nuxtjs.org/api/configuration-router)
  298. router: {
  299. linkActiveClass: "active-link",
  300. linkExactActiveClass: "exact-active-link",
  301. },
  302. }