/* eslint-env node */ /* * This file runs in a Node context (it's NOT transpiled by Babel), so use only * the ES6 features that are supported by your Node version. https://node.green/ */ // Configuration for your app // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js const { configure } = require("quasar/wrappers"); // https://downloads.gradle-dn.com/distributions/gradle-4.10.3-all.zip // process.env['ORG_GRADLE_PROJECT_cdvCompileSdkVersion'] = 33 // process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] = 'https\\://downloads.gradle-dn.com/distributions/gradle-4.10.3-all.zip' // process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] = 'https://downloads.gradle.org/distributions/gradle-7.6.1-all.zip' // process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] = 'https://downloads.gradle.org/distributions/gradle-7.5.1-all.zip' // const package = require("./package.json") // import { UserConfig as ViteUserConfig } from "vite"; // import { Options as VuePluginOptions } from "@vitejs/plugin-vue" // const vuePlugin = require('@vitejs/plugin-vue'); const path = require('path'); const fs = require('fs'); const fse = require('fs-extra') const Components = require('unplugin-vue-components/vite'); const VantResolver = require('unplugin-vue-components/resolvers').VantResolver; const packageInfo = require("./package.json") module.exports = configure(function ( ctx ) { const BASE_URL = ctx.mode.cordova ? 'https://buyer.daxiangzj.com/' : '/' // const BASE_URL = 'http://jingcai.quickfly.eu.org:3000/' if (ctx.mode.cordova) { if (ctx.target.android) { require('./scripts/addCustomMirror.js')(ctx); } if(ctx.prod){ fse.emptyDirSync(path.join(__dirname,'/src-cordova/www')) console.log('清空 src-cordova/www 目录') } require('./scripts/setConfigXml.js')(ctx) } return { eslint: { // fix: true, // include: [], // exclude: [], // rawOptions: {}, warnings: true, errors: true }, // https://v2.quasar.dev/quasar-cli/prefetch-feature // preFetch: true, // app boot file (/src/boot) // --> boot files are part of "main.js" // https://v2.quasar.dev/quasar-cli/boot-files boot: ["appExtension", "axios","mobile"], // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css css: ["app.scss"], // https://github.com/quasarframework/quasar/tree/dev/extras extras: [ // 'ionicons-v4', // 'mdi-v5', 'mdi-v6', // 'fontawesome-v6', // 'eva-icons', // 'themify', // 'line-awesome', // 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both! // "roboto-font", // optional, you are not bound to it // "material-icons-outlined", // "material-icons-round" "material-icons" // optional, you are not bound to it ], // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#build build: { target: { browser: ["es2019", "edge88", "firefox78", "chrome87", "safari13.1"], node: "node16" }, vueRouterMode: "hash", // available values: 'hash', 'history' // vueRouterBase, // vueDevtools, // vueOptionsAPI: false, // rebuildCache: true, // rebuilds Vite/linter/etc cache on startup // publicPath: '/', // analyze: true, env: { BASE_URL: ctx.dev ? '/' : BASE_URL, WEB_VERSION: packageInfo.version }, // rawDefine: {} // ignorePublicFolder: true, // minify: false, // polyfillModulePreload: true, // distDir // extendViteConf (viteConf) {}, // viteVuePluginOptions: {}, vitePlugins: [ // vuePlugin(), Components({ resolvers: [VantResolver()], }), ], afterBuild:(QuasarHookParams)=>{ console.log(QuasarHookParams) const distDir = QuasarHookParams.quasarConf.build.distDir const content = fs.readFileSync(path.join(distDir,'./index.html'),{encoding:'utf8'}) .replace('
',''); fs.writeFile( path.join(distDir,'./app.html'), content, 'utf8', ()=>{ console.log('write app.html') } ); } }, // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer devServer: { https: false, open: false, // opens browser window automatically proxy: { // 将所有以/api开头的请求代理到jsonplaceholder "/api": { // target: 'http://buyer.jingcai.quickfly.eu.org:3000/', target: 'https://m168.yunduoxd.com/', changeOrigin: true, secure: false // pathRewrite: false }, "/uploads":{ // target: 'http://jingcai.quickfly.eu.org:3000/', target: 'https://m168.yunduoxd.com/', changeOrigin: true, secure: false } } }, // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework framework: { // iconSet: 'fontawesome-v6', config: { notify: { position:'center', timeout: 1000 }, loadingBar: { skipHijack: true }, loading:{backgroundColor: 'transparent',spinnerColor:'primary',spinnerSize:'36px'} }, // iconSet: 'material-icons', // Quasar icon set lang: 'zh-CN', // Quasar language pack // For special cases outside of where the auto-import strategy can have an impact // (like functional components as one of the examples), // you can manually specify Quasar components/directives to be available everywhere: // // components: [], // directives: [], // Quasar plugins plugins: [ "AddressbarColor", "AppFullscreen", "AppVisibility", "BottomSheet", "Dialog", "Notify", "LoadingBar", "LocalStorage", "Loading" ], cordova: { // 在iOS移动设备上添加动态顶部填充(top padding) iosStatusBarPadding: false, // Quasar在手机回退按钮上处理应用程序退出。 // Quasar v1.9.3+使用true/false,v1.12.6+使用'*'通配符和数组值 // backButtonExit: true/false/'*'/['/login', '/home', '/my-page'], backButtonExit: false, // On the other hand, the following completely // disables Quasar's back button management. // Requires Quasar v1.14.1+ // 另一方面,下面的设置完全禁用了 // Quasar的后退按钮管理。 // 需要Quasarv1.14.1+ // backButton: true/false, backButton: true } }, // animations: 'all', // --- includes all animations // https://v2.quasar.dev/options/animations animations: [], // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#property-sourcefiles // sourceFiles: { // rootComponent: 'src/App.vue', // router: 'src/router/index', // store: 'src/store/index', // registerServiceWorker: 'src-pwa/register-service-worker', // serviceWorker: 'src-pwa/custom-service-worker', // pwaManifestFile: 'src-pwa/manifest.json', // electronMain: 'src-electron/electron-main', // electronPreload: 'src-electron/electron-preload' // }, // https://v2.quasar.dev/quasar-cli/developing-ssr/configuring-ssr ssr: { // ssrPwaHtmlFilename: 'offline.html', // do NOT use index.html as name! // will mess up SSR // extendSSRWebserverConf (esbuildConf) {}, // extendPackageJson (json) {}, pwa: false, // manualStoreHydration: true, // manualPostHydrationTrigger: true, prodPort: 3000, // The default port that the production server should use // (gets superseded if process.env.PORT is specified at runtime) middlewares: [ "render" // keep this as last one ] }, // https://v2.quasar.dev/quasar-cli/developing-pwa/configuring-pwa pwa: { workboxMode: "generateSW", // or 'injectManifest' injectPwaMetaTags: true, swFilename: "sw.js", manifestFilename: "manifest.json", useCredentialsForManifestTag: false // useFilenameHashes: true, // extendGenerateSWOptions (cfg) {} // extendInjectManifestOptions (cfg) {}, // extendManifestJson (json) {} // extendPWACustomSWConf (esbuildConf) {} }, // Full list of options: https://v2.quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova cordova: { // id: package.cordovaId, // version: package.version, // name: package.name, // description: package.description, // androidVersionCode: appconf.androidVersionCode // noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing }, // Full list of options: https://v2.quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor capacitor: { hideSplashscreen: true }, // Full list of options: https://v2.quasar.dev/quasar-cli/developing-electron-apps/configuring-electron electron: { // extendElectronMainConf (esbuildConf) // extendElectronPreloadConf (esbuildConf) inspectPort: 5858, bundler: "packager", // 'packager' or 'builder' packager: { // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options // OS X / Mac App Store // appBundleId: '', // appCategoryType: '', // osxSign: '', // protocol: 'myapp://path', // Windows only // win32metadata: { ... } }, builder: { // https://www.electron.build/configuration/configuration appId: "jingcai" } }, // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-browser-extensions/configuring-bex bex: { contentScripts: ["my-content-script"] // extendBexScriptsConf (esbuildConf) {} // extendBexManifestJson (json) {} } }; });