From 131fe8a17e1e5ffc3b80b0a676672c7d6f724d95 Mon Sep 17 00:00:00 2001 From: Nur Muhammad Date: Wed, 17 Jan 2024 09:19:04 +0800 Subject: [PATCH] Add build for vercel --- package.json | 3 ++- quasar.conf.js | 44 ++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index e86709b..976c7c7 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "lint": "eslint --ext .js,.vue ./", "test": "echo \"No test specified\" && exit 0", "dev": "NODE_OPTIONS=--openssl-legacy-provider && quasar dev -m pwa", - "build": "NODE_OPTIONS=--openssl-legacy-provider && quasar build -m pwa" + "build": "NODE_OPTIONS=--openssl-legacy-provider && quasar build -m pwa", + "build-vercel": "NODE_OPTIONS=--openssl-legacy-provider && PUBLIC_PATH=/ quasar build -m pwa" }, "dependencies": { "@quasar/extras": "^1.0.0", diff --git a/quasar.conf.js b/quasar.conf.js index 80711fe..b8ba96c 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -7,7 +7,7 @@ // https://quasar.dev/quasar-cli/quasar-conf-js /* eslint-env node */ -module.exports = function(ctx) { +module.exports = function (ctx) { return { // https://quasar.dev/quasar-cli/supporting-ts supportTS: false, @@ -34,17 +34,17 @@ module.exports = function(ctx) { // 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both! "roboto-font", // optional, you are not bound to it - "material-icons" // optional, you are not bound to it + "material-icons", // optional, you are not bound to it ], // Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build build: { vueRouterMode: "history", // available values: 'hash', 'history' - publicPath: ctx.dev ? "/" : "/quran-id/", + publicPath: ctx.dev ? "/" : process.env.PUBLIC_PATH ?? "/quran-id/", // transpile: false, env: { QURAN_API_BASE_URL: "https://api.quran.com/api/v4/", - GTAG_ENABLED: ctx.prod + GTAG_ENABLED: ctx.prod, }, // Add dependencies for transpiling with Babel (Array of string/regex) @@ -67,16 +67,16 @@ module.exports = function(ctx) { enforce: "pre", test: /\.(js|vue)$/, loader: "eslint-loader", - exclude: /node_modules/ + exclude: /node_modules/, }); - } + }, }, // Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer devServer: { https: false, port: 8080, - open: true // opens browser window automatically + open: true, // opens browser window automatically }, // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework @@ -98,7 +98,7 @@ module.exports = function(ctx) { // directives: [], // Quasar plugins - plugins: ["Notify", "LocalStorage", "Meta"] + plugins: ["Notify", "LocalStorage", "Meta"], }, // animations: 'all', // --- includes all animations @@ -107,7 +107,7 @@ module.exports = function(ctx) { // https://quasar.dev/quasar-cli/developing-ssr/configuring-ssr ssr: { - pwa: false + pwa: false, }, // https://quasar.dev/quasar-cli/developing-pwa/configuring-pwa @@ -115,7 +115,7 @@ module.exports = function(ctx) { workboxPluginMode: "GenerateSW", // 'GenerateSW' or 'InjectManifest' workboxOptions: { skipWaiting: true, - clientsClaim: true + clientsClaim: true, }, // only for GenerateSW manifest: { name: `Al-Quran`, @@ -129,30 +129,30 @@ module.exports = function(ctx) { { src: "icons/icon-128x128.png", sizes: "128x128", - type: "image/png" + type: "image/png", }, { src: "icons/icon-192x192.png", sizes: "192x192", - type: "image/png" + type: "image/png", }, { src: "icons/icon-256x256.png", sizes: "256x256", - type: "image/png" + type: "image/png", }, { src: "icons/icon-384x384.png", sizes: "384x384", - type: "image/png" + type: "image/png", }, { src: "icons/icon-512x512.png", sizes: "512x512", - type: "image/png" - } - ] - } + type: "image/png", + }, + ], + }, }, // Full list of options: https://quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova @@ -162,7 +162,7 @@ module.exports = function(ctx) { // Full list of options: https://quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor capacitor: { - hideSplashscreen: true + hideSplashscreen: true, }, // Full list of options: https://quasar.dev/quasar-cli/developing-electron-apps/configuring-electron @@ -183,7 +183,7 @@ module.exports = function(ctx) { builder: { // https://www.electron.build/configuration/configuration - appId: "quran-id" + appId: "quran-id", }, // More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration @@ -192,7 +192,7 @@ module.exports = function(ctx) { extendWebpack(/* cfg */) { // do something with Electron main process Webpack cfg // chainWebpack also available besides this extendWebpack - } - } + }, + }, }; };