nuxt.config.js 9.8 KB

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