quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.78k stars 3.5k forks source link

indexHtmlTemplate not working on vite #17257

Closed diadal closed 3 months ago

diadal commented 3 months ago

What happened?

App • ⚠️ The file /index.html is missing. Please add it back.

how to rename index.html in vite

 sourceFiles: {
      indexHtmlTemplate: ctx.mode?.capacitor
        ? 'index.cap.html'
        : 'index.web.html',
    }

What did you expect to happen?

renamed index.html should work

Reproduction URL

no link

How to reproduce?

https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#sourcefiles

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite), TypeScript Support, SPA Mode, Capacitor Mode

Platforms/Browsers

No response

Quasar info output

Operating System - Darwin(23.5.0) - darwin/arm64
NodeJs - 20.12.2

Global packages
  NPM - 10.8.1
  yarn - 1.22.22
  pnpm - Not installed
  bun - Not installed
  @quasar/cli - 2.4.1
  @quasar/icongenie - 3.1.1
  cordova - Not installed

Important local packages
  quasar - 2.16.4 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 2.0.0-beta.14 -- Quasar Framework App CLI with Vite
  @quasar/extras - 1.16.11 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.4.26 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.3.2
  pinia - 2.1.7 -- Intuitive, type safe and flexible Store for Vue
  vuex - Not installed
  vite - 5.2.11 -- Native-ESM powered web dev build tool
  vite-plugin-checker - Not installed
  eslint - 8.57.0 -- An AST-based pattern checker for JavaScript.
  esbuild - 0.20.2 -- An extremely fast JavaScript and CSS bundler and minifier.
  typescript - 5.4.5 -- TypeScript is a language for application scale JavaScript development
  workbox-build - 7.1.0 -- A module that integrates into your build process, helping you generate a manifest of local files that workbox-sw should precache.
  register-service-worker - Not installed
  electron - Not installed
  electron-packager - Not installed
  @electron/packager - Not installed
  electron-builder - Not installed
  @capacitor/core - 6.0.0 -- Capacitor: Cross-platform apps with JavaScript and the web
  @capacitor/cli - 6.0.0 -- Capacitor: Cross-platform apps with JavaScript and the web
  @capacitor/android - 6.0.0 -- Capacitor: Cross-platform apps with JavaScript and the web
  @capacitor/ios - 6.0.0 -- Capacitor: Cross-platform apps with JavaScript and the web

Quasar App Extensions
  *None installed*


### Relevant log output

_No response_

### Additional context

_No response_
github-actions[bot] commented 3 months ago

Hi @diadal! 👋

It looks like you provided an invalid or unsupported reproduction URL. Do not use any service other than Codepen, jsFiddle, StackBlitz, Codesandbox, and GitHub. Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc. Please edit your original post above and provide a valid reproduction URL as explained.

Without a proper reproduction, your issue will have to get closed.

Thank you for your collaboration. 👏

yusufkandemir commented 3 months ago

Hello. This is not a bug as there is no such option in app-vite. The reason behind that is Vite is designed to work with index.html: https://vitejs.dev/guide/#index-html-and-project-root

You can use EJS in the index.html file. So, you can do something like:

<% if (ctx.mode.capacitor) { %>
<div>Capacitor specific content</div>
<% } %>