nuxt-modules / ionic

Batteries-included, zero-config Ionic integration for Nuxt
https://ionic.nuxtjs.org
MIT License
378 stars 38 forks source link

symlink `dist/` folder to `.output/public/` #499

Open frankspee opened 10 months ago

frankspee commented 10 months ago

πŸ†’ Your use case

When I use nuxt generate I would expect to get a dist folder symlinked to .output/public so that the behaviour of this module is the same as standard Nuxt.

πŸ†• The solution you'd like

Do a Nuxt generate, pnpm generate or ionic:build, where ionic build starts a generate (which it doesn't out of the box).

And get a .output/public folder with the correct generated static site, so we can also use that folder. Or that the dist folder is symlinked to the .output/public like it normally does.

It seems to me that there is no reason to do the static site generation different from default Nuxt. It could only introduce bugs or unexpected behaviour for developers / during deployment.

πŸ” Alternatives you've considered

I am currently using the alternative to not use this module and instead use a Nuxt build with the Ionic framework and Capacitor libraries added by myself to the stack. I would love to use this module, but I think it is to WIP / unstable right now.

ℹ️ Additional info

No response

i4innovationnet commented 10 months ago

Ran into the same issue, couldn't figure out why the dist location was different until I came across this.

danielroe commented 10 months ago

The reason this module doesn't do that is that there was an issue with ionic sync: https://github.com/nuxt-modules/ionic/issues/363. Is that no longer the case?

frankspee commented 10 months ago

@danielroe Thank you for linking the issue. I guess we are talking about the ionic cap sync (or npx cap sync after a build).

In my nuxt & ionic without module test project I could not reproduce this issue. Note: I am trying to get this in a codespace or something, but I don't know how to do a ionic/capacitor cli install there.

I did however link the webDir directly to .output/public at first - this is without this module. I tested it today with the symlinked dist folder as well. Sync keeps working even if I do a clean build (removing dist and .output first).

I also tested this with a npx nuxi@latest cleanup and npx nuxi@latest upgrade --force before trying to build and sync again. It just works.

So for me the workaround, whenever dist as webDir in capacitor.config.json is not working, would be to point directly to the .output/public. That looks less code to change by me.

frankspee commented 10 months ago

I actually tried to revert commit https://github.com/nuxt-modules/ionic/commit/2dfd31d9fedb3f088f37e14045aef6d056b6b9a8 locally on my machine with a clone of this repository.

I think it works well, so you can test this revert with the PR here: https://github.com/nuxt-modules/ionic/pull/506