Closed loicngr closed 2 days ago
It checks "is the active mode Capacitor" to decide whether it should add Capacitor deps. So, when you run quasar mode add capacitor
, it runs as the active mode set to Capacitor and correctly generates them. But, if you run quasar prepare
, it generates for SPA(default) mode. After seeing your issue, I thought of two cases:
If the user is only using Capacitor:
quasar prepare
doesn't accept a --mode/-m
parameter, so the user can't really use quasar prepare
. But, it should be fine otherwise with running quasar dev/build
If the user is using Capacitor and some other modes:
quasar prepare
will work fine when they are building for non-Capacitor modesSo, all in all, I think we should adjust the logic to always add aliases for Capacitor deps, if the user has Capacitor mode.
Thanks for reporting and providing good information! The fix will be included in the next app-vite/app-webpack releases.
Thanks for being so responsive and for all your hard work. I really enjoy using Quasar, keep up the good work!
What happened?
When I add Capacitor to my project with
quasar mode add capacitor
it adds new paths in./.quasar/tsconfig.json
. Here is the file:#### ./.quasar/tsconfig.json
```json { "compilerOptions": { "esModuleInterop": true, "skipLibCheck": true, "target": "esnext", "allowJs": true, "resolveJsonModule": true, "moduleDetection": "force", "isolatedModules": true, "module": "preserve", "noEmit": true, "lib": [ "esnext", "dom", "dom.iterable" ], "strict": true, "allowUnreachableCode": false, "allowUnusedLabels": false, "noImplicitOverride": true, "exactOptionalPropertyTypes": true, "noUncheckedIndexedAccess": true, "paths": { "src": [ "./../src" ], "src/*": [ "./../src/*" ], "app": [ "./.." ], "app/*": [ "./../*" ], "components": [ "./../src/components" ], "components/*": [ "./../src/components/*" ], "layouts": [ "./../src/layouts" ], "layouts/*": [ "./../src/layouts/*" ], "pages": [ "./../src/pages" ], "pages/*": [ "./../src/pages/*" ], "assets": [ "./../src/assets" ], "assets/*": [ "./../src/assets/*" ], "boot": [ "./../src/boot" ], "boot/*": [ "./../src/boot/*" ], "stores": [ "./../src/stores" ], "stores/*": [ "./../src/stores/*" ], "#q-app": [ "./../node_modules/@quasar/app-vite/types/index.d.ts" ], "#q-app/wrappers": [ "./../node_modules/@quasar/app-vite/types/app-wrappers.d.ts" ], "#q-app/bex/background": [ "./../node_modules/@quasar/app-vite/types/bex/entrypoints/background.d.ts" ], "#q-app/bex/content": [ "./../node_modules/@quasar/app-vite/types/bex/entrypoints/content.d.ts" ], "#q-app/bex/private/bex-bridge": [ "./../node_modules/@quasar/app-vite/types/bex/bex-bridge.d.ts" ], "@capacitor/app": [ "./../src-capacitor/node_modules/@capacitor/app" ], "@capacitor/app/*": [ "./../src-capacitor/node_modules/@capacitor/app/*" ], "@capacitor/cli": [ "./../src-capacitor/node_modules/@capacitor/cli" ], "@capacitor/cli/*": [ "./../src-capacitor/node_modules/@capacitor/cli/*" ], "@capacitor/core": [ "./../src-capacitor/node_modules/@capacitor/core" ], "@capacitor/core/*": [ "./../src-capacitor/node_modules/@capacitor/core/*" ] } }, "include": [ "./**/*.d.ts", "./../**/*" ], "exclude": [ "./../dist", "./../node_modules", "./../src-capacitor", "./../src-cordova", "./../quasar.config.*.temporary.compiled*" ] } ```On a new installation, after an
npm install
orquasar prepare
it doesn't add new paths in the tsconfig. Here's the tsconfig after annpm install
orquasar prepare
.#### ./.quasar/tsconfig.json
```json { "compilerOptions": { "esModuleInterop": true, "skipLibCheck": true, "target": "esnext", "allowJs": true, "resolveJsonModule": true, "moduleDetection": "force", "isolatedModules": true, "module": "preserve", "noEmit": true, "lib": [ "esnext", "dom", "dom.iterable" ], "strict": true, "allowUnreachableCode": false, "allowUnusedLabels": false, "noImplicitOverride": true, "exactOptionalPropertyTypes": true, "noUncheckedIndexedAccess": true, "paths": { "src": [ "./../src" ], "src/*": [ "./../src/*" ], "app": [ "./.." ], "app/*": [ "./../*" ], "components": [ "./../src/components" ], "components/*": [ "./../src/components/*" ], "layouts": [ "./../src/layouts" ], "layouts/*": [ "./../src/layouts/*" ], "pages": [ "./../src/pages" ], "pages/*": [ "./../src/pages/*" ], "assets": [ "./../src/assets" ], "assets/*": [ "./../src/assets/*" ], "boot": [ "./../src/boot" ], "boot/*": [ "./../src/boot/*" ], "stores": [ "./../src/stores" ], "stores/*": [ "./../src/stores/*" ], "#q-app": [ "./../node_modules/@quasar/app-vite/types/index.d.ts" ], "#q-app/wrappers": [ "./../node_modules/@quasar/app-vite/types/app-wrappers.d.ts" ], "#q-app/bex/background": [ "./../node_modules/@quasar/app-vite/types/bex/entrypoints/background.d.ts" ], "#q-app/bex/content": [ "./../node_modules/@quasar/app-vite/types/bex/entrypoints/content.d.ts" ], "#q-app/bex/private/bex-bridge": [ "./../node_modules/@quasar/app-vite/types/bex/bex-bridge.d.ts" ] } }, "include": [ "./**/*.d.ts", "./../**/*" ], "exclude": [ "./../dist", "./../node_modules", "./../src-capacitor", "./../src-cordova", "./../quasar.config.*.temporary.compiled*" ] } ```I could be wrong, but I don't think this is intentional behavior.
What did you expect to happen?
After an
npm install
, it shouldn't delete the Capacitor “paths” in the tsconfig.json.Reproduction URL
https://github.com/loicngr/quasar-rc-capacitor
How to reproduce?
npm install
quasar mode add capacitor
./quasar/tsconfig.json
. There are Capacitor pathsnpm install
again../quasar/tsconfig.json
. There are not Capacitor pathsFlavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite), TypeScript Support, Capacitor Mode
Platforms/Browsers
Chrome, Android
Quasar info output
Relevant log output
No response
Additional context
No response