ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.23k stars 1.01k forks source link

bug: svelte detection in https://github.com/ionic-team/capacitor/blob/main/cli/src/framework-configs.ts #6150

Open Tommertom opened 1 year ago

Tommertom commented 1 year ago

Bug Report

Capacitor Version

Current version - just by reading source code

This code snippet in https://github.com/ionic-team/capacitor/blob/main/cli/src/framework-configs.ts

  {
    name: 'Svelte',
    isMatch: config =>
      hasDependency(config, 'svelte') && hasDependency(config, 'sirv-cli'),
    webDir: 'public',
    priority: 3,
  },

SvelteKit rc 1.0 does not have sirv anymore

SvelteKit with adapter static and in SPA mode (ssr=false) needs build webDir. With ssr=true I believe there is build/client and build/server.

SvelteKit other than static - I believe cannot be deployed in Capacitor (because requiring express server) - so then issue warning "wrong adapter?".. Maybe getting a bit complicated this way.

Then we have Svelte with Vite npm create vite@latest (so not Kit) - which probably needs separate detection? I think it is build for this one - but not sure.

Maybe as alternative to trying to code this - remove the above snippet and giving a notice to the user that the CLI was not able to conclusively establish which framework so better to check webDir manually (defaulted to whatever..)

jcesarmobile commented 1 year ago

vite detection is already there https://github.com/ionic-team/capacitor/pull/6039

but not sveltekit, can you provide a sample app?

Tommertom commented 1 year ago

Ok great- here a happy path SvelteKit app (adapter static and ssr=false) - https://github.com/Tommertom/svelte-ionic-app