API 浏览器
Quasar CLI with Vite - @quasar/app-vite
配置 quasar.config 文件

请注意,你的脚手架项目文件夹包含一个 /quasar.config 文件。那么你可以通过它配置什么?基本上,Quasar CLI 为你执行的所有操作都包含在内。

¥Notice that your scaffolded project folder contains a /quasar.config file. So what can you configure through it? Basically anything that Quasar CLI does for you.

  • 你将在网站/应用中使用的 Quasar 组件、指令和插件

    ¥Quasar components, directives and plugins that you’ll be using in your website/app

  • 默认 Quasar 语言包

    ¥Default Quasar Language Pack

  • 你希望使用的 图标库

    ¥Icon libraries that you wish to use

  • Quasar 组件的默认 Quasar 图标集

    ¥Default Quasar Icon Set for Quasar components

  • 开发服务器端口、HTTPS 模式、主机名等

    ¥Development server port, HTTPS mode, hostname and so on

  • 你希望使用的 CSS 动画

    ¥CSS animations that you wish to use

  • 启动文件 列表(也决定执行顺序) - 这些文件位于 /src/boot 中,用于指示在挂载根 Vue 组件之前如何初始化应用。

    ¥Boot Files list (that determines order of execution too) – which are files in /src/boot that tell how your app is initialized before mounting the root Vue component

  • 全局 CSS/Sass/…要包含在 bundle 中的文件

    ¥Global CSS/Sass/… files to be included in the bundle

  • SPA、PWA、Electron、Capacitor、Cordova、SSR、BEX(浏览器扩展)配置

    ¥SPA, PWA, Electron, Capacitor, Cordova, SSR, BEX (browser extensions) configuration

  • 扩展底层工具,例如生成的 Vite 配置

    ¥Extend the under the hood tools, like the generated Vite config

  • …以及你将在此过程中发现的更多内容

    ¥…and many many more that you’ll discover along the way

提示

你会注意到,更改任何这些设置都不需要手动重新加载开发服务器。Quasar 会检测并重新加载必要的进程。你不会中断开发流程,因为你可以静待 Quasar CLI 快速重新加载更改的代码,甚至保持当前状态。这将节省你大量的时间!

¥You’ll notice that changing any of these settings does not require you to manually reload the dev server. Quasar detects and reloads the necessary processes. You won’t lose your development flow, because you can just sit back while Quasar CLI quickly reloads the changed code, even keeping the current state. This saves tons of your time!

警告

/quasar.config 文件由 Quasar CLI 构建系统运行,因此此代码直接在 Node 下运行,而不是在你的应用上下文中运行。这意味着你可以引用 node:fsnode:path、Vite 插件等模块。

¥The /quasar.config file is run by the Quasar CLI build system, so this code runs under Node directly, not in the context of your app. This means you can require modules like node:fs, node:path, Vite plugins, and so on.

结构(Structure)

¥Structure

基础知识(The basics)

¥The basics

你会注意到,/quasar.config 文件导出了一个函数,该函数接受 ctx(上下文)参数并返回一个对象。这允许你根据以下上下文动态更改你的网站/应用配置:

¥You’ll notice that the /quasar.config file exports a function that takes a ctx (context) parameter and returns an Object. This allows you to dynamically change your website/app config based on this context:

/quasar.config file

import { defineConfig } from '#q-app/wrappers'

export default defineConfig((ctx) => { // can be async too
  console.log(ctx)

  // Example output on console:
  /*
  {
    dev: true,
    prod: false,
    mode: { spa: true },
    modeName: 'spa',
    target: {},
    targetName: undefined,
    arch: {},
    archName: undefined,
    debug: undefined
  }
  */

  // context gets generated based on the parameters
  // with which you run "quasar dev" or "quasar build"

  return {
    // ... your config
  }
})

例如,你可以在为特定模式(如 PWA)构建时加载一种字体,并为其他模式选择另一种字体:

¥What this means is that, as an example, you can load a font when building for a certain mode (like PWA), and pick another one for the others:

/quasar.config file

{
  extras: [
    ctx.mode.pwa // we're adding only if working on a PWA
      ? 'roboto-font'
      : null
  ]
}

或者你可以为 SPA 模式使用一个全局 CSS 文件,为 Cordova 模式使用另一个全局 CSS 文件,同时避免在其他模式下加载任何此类文件。

¥Or you can use a global CSS file for SPA mode and another one for Cordova mode while avoiding loading any such file for the other modes.

/quasar.config file

{
  css: [
    ctx.mode.spa ? 'app-spa.sass' : null, // looks for /src/css/app-spa.sass
    ctx.mode.cordova ? 'app-cordova.sass' : null  // looks for /src/css/app-cordova.sass
  ]
}

或者你可以将开发服务器配置为在 SPA 模式下运行在 8000 端口,在 PWA 模式下运行在 9000 端口,在其他模式下运行在 9090 端口:

¥Or you can configure the dev server to run on port 8000 for SPA mode, on port 9000 for PWA mode or on port 9090 for the other modes:

/quasar.config file

{
  devServer: {
    port: ctx.mode.spa
      ? 8000
      : (ctx.mode.pwa ? 9000 : 9090)
  }
}

你还可以在返回 quasar 配置之前执行异步工作:

¥You can also do async work before returning the quasar configuration:

/quasar.config file

import { defineConfig } from '#q-app/wrappers'

export default async defineConfig((ctx) => {
  const data = await someAsyncFunction()
  return {
    // ... use "data"
  }
})

// or:
export default defineConfig((ctx) => {
  return new Promise(resolve => {
    // some async work then:
    // resolve() with the quasar config
    resolve({
      //
    })
  })
})

可能性无穷无尽。

¥The possibilities are endless.

IDE 自动补齐(IDE autocompletion)

¥IDE autocompletion

请注意从 #q-app/wrappers 导入的 defineConfig。这本质上是一个无操作函数,但它的作用是帮助提升 IDE 的自动补齐体验。

¥Notice the defineConfig import from #q-app/wrappers. This is essentially a no-op function but what it does is it helps with the IDE autocomplete experience.

/quasar.config file

import { defineConfig } from '#q-app/wrappers'

export default defineConfig((ctx) => {
  /* configuration options */
})

要配置的选项(Options to Configure)

¥Options to Configure

css(css)

/**

 * Global CSS/Stylus/SCSS/SASS/... files from `/src/css/`,

 * except for theme files, which are included by default.
 */
css?: string[];

示例:

¥Example:

/quasar.config file

{
  css: [
    'app.sass', // referring to /src/css/app.sass
    '~some-library/style.css' // referring to node_modules/some-library/style.css
  ]
}

boot(boot)

更多关于 启动文件 的信息。

¥More on Boot Files.

/** Boot files to load. Order is important. */
boot?: QuasarBootConfiguration;

interface BootConfigurationItem {
  path: string;
  server?: false;
  client?: false;
}

type QuasarBootConfiguration = (string | BootConfigurationItem)[];

preFetch(preFetch)

更多信息请参阅 预取功能 页面。

¥More on the PreFetch Feature page.

/** Enable the preFetch feature. */
preFetch?: boolean;

extras(extras)

/**

 * What to import from [@quasar/extras](https://github.com/quasarframework/quasar/tree/dev/extras) package.

 * @example ['material-icons', 'roboto-font', 'ionicons-v4']
 */
extras?: (QuasarIconSets | QuasarFonts)[];

framework(framework)

/**

 * What Quasar language pack to use, what Quasar icon

 * set to use for Quasar components, etc.
 */
framework?: {
  /**

   * @see - QuasarConfOptions tab in API cards throughout the docs
   */
  config?: SerializableConfiguration<QuasarUIConfiguration>;
  /**

   * One of the Quasar IconSets

   *    * @see https://v2.quasar.dev/options/quasar-icon-sets

   *    * @example 'material-icons'
   */
  iconSet?: QuasarIconSets;
  /**

   * One of the Quasar language packs

   *    * @see https://v2.quasar.dev/options/quasar-language-packs

   *    * @example 'en-US'

   * @example 'es'
   */
  lang?: QuasarLanguageCodes;
  /**

   * Quasar CSS addons have breakpoint aware versions of flex and spacing classes

   *    * @see https://v2.quasar.dev/layout/grid/introduction-to-flexbox#flex-addons

   * @see https://v2.quasar.dev/style/spacing#flex-addons
   */
  cssAddon?: boolean;

  /**

   * Auto import - how to detect components in your vue files

   *   "kebab": q-carousel q-page

   *   "pascal": QCarousel QPage

   *   "combined": q-carousel QPage

   *    * @default 'kebab'
   */
  autoImportComponentCase?: "kebab" | "pascal" | "combined";
  /**

   * Auto import - which file extensions should be interpreted as referring to Vue SFC?

   *    * @default ['vue']
   */
  autoImportVueExtensions?: string[];
  /**

   * Auto import - which file extensions should be interpreted as referring to script files?

   *    * @default ['js', 'jsx', 'ts', 'tsx']
   */
  autoImportScriptExtensions?: string[];
  /**

   * Treeshake Quasar's UI on dev too?

   * Recommended to leave this as false for performance reasons.

   *    * @default false
   */
  devTreeshaking?: boolean;

  /**

   * Quasar will auto import components based on your usage.

   * But, in case you have a special case, you can manually specify Quasar components to be available everywhere.

   *    * An example case would be having custom component definitions with plain string templates, inside .js or .ts files,

   * in which you are using Quasar components (e.g. q-avatar).

   *    * Another example would be that dynamically rendering components depending on an API response or similar (e.g. in a CMS),

   * something like `<component :is="dynamicName">` where `dynamicName` is a string that matches a Quasar component name.

   *    * @example ['QAvatar', 'QChip']
   */
  components?: (keyof QuasarComponents)[];
  /**

   * Quasar will auto import directives based on your usage.

   * But, in case you have a special case, you can manually specify Quasar directives to be available everywhere.

   *    * An example case would be having custom component definitions with plain string templates, inside .js or .ts files,

   * in which you are using Quasar directives (e.g. v-intersection).

   *    * @example ['Intersection', 'Mutation']
   */
  directives?: (keyof QuasarDirectives)[];
  /**

   * Quasar plugins to be installed. Specify the ones you are using in your app.

   *    * @example ['Notify', 'Loading', 'Meta', 'AppFullscreen']
   */
  plugins?: (keyof QuasarPlugins)[];
}

有关更多信息,请参阅以下参考资料:

¥See these references for more info:

animations(animations)

更多关于 CSS 动画 的信息。

¥More on CSS animations.

/**

 * What Quasar CSS animations to import.

 * @example [ 'bounceInLeft', 'bounceOutRight' ]

 * */
animations?: QuasarAnimationsConfiguration | 'all';

devServer(devServer)

更多信息:Vite 服务器选项

¥More info: Vite server options

import { ServerOptions as ViteServerOptions } from "vite";
import { Options as OpenOptions } from "open";
type DevServerOptions = Omit<ViteServerOptions, "open" | "https"> & {
  open?: Omit<OpenOptions, "wait"> | boolean;
  https?: ViteServerOptions["https"] | boolean;
};

/**

 * Vite "server" options.

 * Some properties are overwritten based on the Quasar mode you're using in order

 * to ensure a correct config.

 * Note: if you're proxying the development server (i.e. using a cloud IDE),

 * set the `public` setting to your public application URL.
 */
devServer?: DevServerOptions;

除了这些选项外,Quasar CLI 还会篡改一些选项,你的体验与 Vite 应用不同:

¥Apart from these options, Quasar CLI tampers with some and you will experience them differently than on a Vite app:

使用 open 属性可以使用特定浏览器打开,而不是使用操作系统的默认浏览器(请检查 支持的值)。你应该使用上一个链接中描述的 options 参数来配置 quasar.config 文件 > devSever > open。一些示例:

¥Using open prop to open with a specific browser and not with the default browser of your OS (check supported values). The options param described in previous link is what you should configure quasar.config file > devSever > open with. Some examples:

/quasar.config file

// opens Google Chrome
devServer: {
  open: {
    app: { name: 'google chrome' }
  }
}

// opens Firefox
devServer: {
  open: {
    app: { name: 'firefox' }
  }
}

// opens Google Chrome and automatically deals with cross-platform issues:
import open from 'open'

devServer: {
  open: {
    app: { name: open.apps.chrome }
  }
}

你还可以配置自动打开远程 Vue Devtools:

¥You can also configure automatically opening remote Vue Devtools:

/quasar.config file

devServer: {
  vueDevtools: true
}

build(build)

/** Build configuration options. */
build?: QuasarBuildConfiguration;

import { Plugin, UserConfig as ViteUserConfig } from "vite";
import { Options as VuePluginOptions } from "@vitejs/plugin-vue"

interface InvokeParams {
  isClient: boolean;
  isServer: boolean;
}

interface BuildTargetOptions {
  /**

   * @default ['es2022', 'firefox115', 'chrome115', 'safari14']
   */
  browser?: string[];
  /**

   * @example 'node20'
   */
  node?: string;
}

interface PluginEntryRunOptions {
  server?: boolean;
  client?: boolean;
}

type PluginEntry =
  | [pluginName: string, options?: any, runOptions?: PluginEntryRunOptions]
  | [pluginFactory: (options?: any) => Plugin, options?: any, runOptions?: PluginEntryRunOptions]
  | Plugin
  | null
  | undefined
  | false;

interface QuasarBuildConfiguration {
  /**

   * @example

   * {

   *   browser: ['es2022', 'firefox115', 'chrome115', 'safari14'],

   *   node: 'node20'

   * }
   */
  target?: BuildTargetOptions;
  /**

   * Extend Vite config generated by Quasar CLI.

   *    * You can either return overrides or directly modify the config object.

   *    * @example

   * ```js

   * // return overrides

   * extendViteConf: (config) => ({

   *   optimizeDeps: {

   *     include: ['some-package']

   *   }

   * })

   * ```

   *    * @example

   * ```js

   * // directly modify the config object

   * import { mergeConfig } from 'vite'

   * // ...

   * extendViteConf(config) {

   *   config.optimizeDeps = mergeConfig(config.optimizeDeps, {

   *     include: ['some-package']

   *   }, false)

   * }

   * ```
   */
  extendViteConf?: (
    config: ViteUserConfig,
    invokeParams: InvokeParams
  ) => ViteUserConfig | void;
  /**

   * Options to supply to @vitejs/plugin-vue

   *    * @see https://v2.quasar.dev/quasar-cli-vite/handling-vite#vite-vue-plugin-options
   */
  viteVuePluginOptions?: VuePluginOptions;
  /**

   * Vite plugins

   *    * @see https://v2.quasar.dev/quasar-cli-vite/handling-vite#adding-vite-plugins

   *    * @example

   * // ESM

   * import { somePlugin } from 'some-plugin'

   * // ...

   * [

   *   [ 'some-plugin', { ...pluginOptions... } ],

   *    *   // disable running on client or server threads (set server/client to false):

   *   [ 'some-plugin', { ...pluginOptions... }, { server: true, client: true } ],

   *    *   [ somePlugin, { ...pluginOptions... } ],

   *    *   // disable running on client or server threads (set server/client to false):

   *   [ somePlugin, { ...pluginOptions... }, { server: true, client: true } ],

   *    *   somePlugin({ ...pluginOptions... })

   * ]

   *    * @example

   * // CJS

   * [

   *   [ 'some-plugin', { ...pluginOptions... } ],

   *    *   // disable running on client or server threads (set server/client to false):

   *   [ 'some-plugin', { ...pluginOptions... }, { server: true, client: true } ],

   *    *   [ require('some-plugin'), { ...pluginOptions... } ],

   *    *   // disable running on client or server threads (set server/client to false):

   *   [ require('some-plugin'), { ...pluginOptions... }, { server: true, client: true } ],

   *    *   require('some-plugin')({ ...pluginOptions... })

   * ]
   */
  vitePlugins?: PluginEntry[];
  /**

   * @see https://v2.quasar.dev/quasar-cli-vite/handling-vite#folder-aliases

   *    * @example

   * {

   *   // import { ... } from 'locales/...'

   *   locales: path.join(__dirname, 'src/locales')

   * }
   */
  alias?: { [key: string]: string };
  /**

   * Configuration for TypeScript integration.
   */
  typescript?: {
    /**

     * Once your codebase is fully using TypeScript and all team members are comfortable with it,

     * you can set this to `true` to enforce stricter type checking.

     * It is recommended to set this to `true` and use stricter typescript-eslint rules.

     *      * It will set the following TypeScript options:

     * - "strict": true

     * - "allowUnreachableCode": false

     * - "allowUnusedLabels": false

     * - "noImplicitOverride": true

     * - "exactOptionalPropertyTypes": true

     * - "noUncheckedIndexedAccess": true

     *      * @see https://ts.nodejs.cn/docs/handbook/migrating-from-javascript.html#getting-stricter-checks
     */
    strict?: boolean;

    /**

     * Extend the generated `.quasar/tsconfig.json` file.

     *      * If you don't have dynamic logic, you can directly modify your `tsconfig.json` file instead.
     */
    extendTsConfig?: (tsConfig: TSConfig) => void;

    /**

     * Generate a shim file for `*.vue` files to process them as plain Vue component instances.

     *      * Vue Language Tools VS Code extension can analyze `*.vue` files in a better way, without the shim file.

     * So, you can disable the shim file generation and let the extension handle the types.

     *      * However, some tools like ESLint can't work with `*.vue` files without the shim file.

     * So, if your tooling is not properly working, enable this option.
     */
    vueShim?: boolean;
  };
  /**

   * Public path of your app.

   * Use it when your public path is something else,

   * like _“<protocol>://<domain>/some/nested/folder”_ – in this case,

   * it means the distributables are in _“some/nested/folder”_ on your webserver.

   *    * @default '/'
   */
  publicPath?: string;
  /**

   * Sets [Vue Router mode](https://router.vuejs.org/guide/essentials/history-mode.html).

   * History mode requires configuration on your deployment web server too.

   *    * @default 'hash'
   */
  vueRouterMode?: "hash" | "history";
  /**

   * Sets Vue Router base.

   * Should not need to configure this, unless absolutely needed.
   */
  vueRouterBase?: string;
  /**

   * Automatically open remote Vue Devtools when running in development mode.
   */
  vueDevtools?: boolean;
  /**

   * Should the Vue Options API be available? If all your components only use Composition API

   * it would make sense performance-wise to disable Vue Options API for a compile speedup.

   *    * @default true
   */
  vueOptionsAPI?: boolean;
  /**

   * Do you want to analyze the production bundles?

   * Generates and opens an HTML report.

   *    * @default false
   */
  analyze?: boolean;
  /**

   * Folder where Quasar CLI should generate the distributables.

   * Relative path to project root directory.

   *    * @default 'dist/{ctx.modeName}' For all modes except Cordova.

   * @default 'src-cordova/www' For Cordova mode.
   */
  distDir?: string;

  /**

   * Add properties to `process.env` that you can use in your website/app JS code.

   *    * @see https://v2.quasar.dev/quasar-cli-vite/handling-process-env

   *    * @example { SOMETHING: 'someValue' }
   */
  env?: { [index: string]: string | boolean | undefined | null };
  /**

   * Defines constants that get replaced in your app.

   * Unlike `env`, you will need to use JSON.stringify() on the values yourself except for booleans.

   * Also, these will not be prefixed with `process.env.`.

   *    * @example { SOMETHING: JSON.stringify('someValue') } -> console.log(SOMETHING) // console.log('someValue')
   */
  rawDefine?: { [index: string]: string | boolean | undefined | null };
  /**

   * Folder where Quasar CLI should look for .env* files.

   * Can be an absolute path or a relative path to project root directory.

   *    * @default project root directory
   */
  envFolder?: string;
  /**

   * Additional .env* files to be loaded.

   * Each entry can be an absolute path or a relative path to quasar.config > build > envFolder.

   *    * @example ['.env.somefile', '../.env.someotherfile']
   */
  envFiles?: string[];

  /**

   * Build production assets with or without the hash part in filenames.

   * Example: "454d87bd" in "assets/index.454d87bd.js"

   *    * When used, please be careful how you configure your web server cache strategy as

   * files will not change name so your client might get 304 (Not Modified) even when

   * it's not the case.

   *    * Will not change anything if your Vite config already touches the

   * build.rollupOptions.output.entryFileNames/chunkFileNames/assetFileNames props.

   *    * Gets applied to production builds only.

   *    * Useful especially for (but not restricted to) PWA. If set to false then updating the

   * PWA will force to re-download all assets again, regardless if they were changed or

   * not (due to how Rollup works through Vite).

   *    * @default true
   */
  useFilenameHashes?: boolean;

  /**

   * whether to inject module preload polyfill.

   * @default false
   */
  polyfillModulePreload?: boolean;
  /**

   * Ignores the public folder.

   * @default false
   */
  ignorePublicFolder?: boolean;

  /**

   * Prepare external services before `$ quasar dev` command runs

   * like starting some backend or any other service that the app relies on.

   * Can use async/await or directly return a Promise.
   */
  beforeDev?: (params: QuasarHookParams) => void;
  /**

   * Run hook after Quasar dev server is started (`$ quasar dev`).

   * At this point, the dev server has been started and is available should you wish to do something with it.

   * Can use async/await or directly return a Promise.
   */
  afterDev?: (params: QuasarHookParams) => void;
  /**

   * Run hook before Quasar builds app for production (`$ quasar build`).

   * At this point, the distributables folder hasn’t been created yet.

   * Can use async/await or directly return a Promise.
   */
  beforeBuild?: (params: QuasarHookParams) => void;
  /**

   * Run hook after Quasar built app for production (`$ quasar build`).

   * At this point, the distributables folder has been created and is available

   *  should you wish to do something with it.

   * Can use async/await or directly return a Promise.
   */
  afterBuild?: (params: QuasarHookParams) => void;
  /**

   * Run hook if publishing was requested (`$ quasar build -P`),

   *  after Quasar built app for production and the afterBuild hook (if specified) was executed.

   * Can use async/await or directly return a Promise.

   * `opts` is Object of form `{arg, distDir}`,

   * where “arg” is the argument supplied (if any) to -P parameter.
   */
  onPublish?: (ops: { arg: string; distDir: string }) => void;

  /**

   * Set to `false` to disable minification, or specify the minifier to use.

   * Available options are 'terser' or 'esbuild'.

   * If set to anything but boolean false then it also applies to CSS.

   * For production only.

   * @default 'esbuild'
   */
  minify?: boolean | 'terser' | 'esbuild';
  /**

   * Minification options for html-minifier-terser.

   *    * @see https://github.com/terser/html-minifier-terser?tab=readme-ov-file#options-quick-reference for complete list of options

   *    * @default

   *  {

   *    removeComments: true,

   *    collapseWhitespace: true,

   *    removeAttributeQuotes: true,

   *    collapseBooleanAttributes: true,

   *    removeScriptTypeAttributes: true

   *  }
   */
  htmlMinifyOptions?: HtmlMinifierOptions;
  /**

   * If `true`, a separate sourcemap file will be created. If 'inline', the

   * sourcemap will be appended to the resulting output file as data URI.

   * 'hidden' works like `true` except that the corresponding sourcemap

   * comments in the bundled files are suppressed.

   * @default false
   */
  sourcemap?: boolean | 'inline' | 'hidden';
}

有关更多信息,请参阅以下参考资料:

¥See these references for more info:

sourceFiles(sourceFiles)

/**

 * Use this property to change the default names of some files of your website/app if you have to.

 * All paths must be relative to the root folder of your project.

 *  * @default

 * {

 *  rootComponent: 'src/App.vue',

 *  router: 'src/router/index',

 *  store: 'src/stores/index',

 *  pwaRegisterServiceWorker: 'src-pwa/register-service-worker',

 *  pwaServiceWorker: 'src-pwa/custom-service-worker',

 *  pwaManifestFile: 'src-pwa/manifest.json',

 *  electronMain: 'src-electron/electron-main',

 *  bexManifestFile: 'src-bex/manifest.json'

 * }
 */
sourceFiles?: {
  rootComponent?: string;
  router?: string;
  store?: string;
  pwaRegisterServiceWorker?: string;
  pwaServiceWorker?: string;
  pwaManifestFile?: string;
  electronMain?: string;
  bexManifestFile?: string;
}

htmlVariables(htmlVariables)

/** Add variables that you can use in /index.html. */
htmlVariables?: Record<string, any>;

你可以在 /index.html 中定义并引用变量,如下所示:

¥You can define and then reference variables in /index.html, like this:

/quasar.config file

import { defineConfig } from '#q-app/wrappers'

export default defineConfig((ctx) => {
  return {
    htmlVariables: {
      myVar: 'some-content'
    }
  }
})

然后,例如:

¥Then, as an example:

/index.html

<%= myVar %>
<% if (myVar) { %>something<% } %>

再举一个例子:

¥One more example:

/quasar.config file

htmlVariables: {
  title: 'test name',
  some: {
    prop: 'my-prop'
  }
}

然后,例如:

¥Then, as an example:

/index.html

<%= title %>
<%= some.prop %>
<% if (some.prop) { %><%= title %><% } %>

Quasar 模式详情(Quasar Mode Specific)

¥Quasar Mode Specific

属性类型描述
cordova对象Cordova 专用 config
capacitor对象Quasar CLI Ca​​pacitor 专用 config
pwa对象PWA 专用 config
ssr对象特定于 SSR 的 config
electron对象电子特定的 config
bex对象BEX 特定于 config

示例(Examples)

¥Examples

设置开发/构建环境(Setting env for dev/build)

¥Setting env for dev/build

请参阅我们文档中的 添加到 process.env 部分。

¥Please refer to Adding to process.env section in our docs.

添加 Vite 插件(Adding Vite plugins)

¥Adding Vite plugins

请参阅 处理 Vite 页面。

¥Please refer to the Handling Vite page.