nue icon indicating copy to clipboard operation
nue copied to clipboard

SPA demo not working when deploy on subpath of domain

Open x4fingers opened this issue 1 year ago • 1 comments

Describe the Bug

The SPA demo is not working when I deploy it on the subpath of the domain.

I followed the document from here: https://nuejs.org/docs/reference/configuration-options.html#base and modified some static paths on the app.

Environment

  • Bun 1.1.6
  • Nue 0.5.3

Minimal Reproduction

For details, I created a repository for demonstration purposes here. I will delete it after this issue is finished.

x4fingers avatar May 02 '24 18:05 x4fingers

Hello, I was looking through older issues, and I checked your demo, and there are some more paths, that have to be changed. Then it works.

The following would be necessary:

  • The router.on paths in app.nue have to use the full urls: /nuejs/…
  • The imports in app.nue need can just use relative imports ./@nue/… / ./model/…
  • The href in the nav in app.nue might need trailing slash. Not sure, may be different between servers.
  • The fetch in /model/index.ts should use relative paths: ./model/…

[!note] The router.on part and ability to use {base} in hrefs (currently not working here) should probably be improved in nue(kit). But SPA stuff is as I can see still low priority

The stuff then has to be deployed/served on a subpath. At least locally it works for me after those changes.

(Currently, with the new beta it seems, like index.html doesn't work anymore. Just use index.md with following content instead: [app :title :description] )

nobkd avatar Aug 19 '24 23:08 nobkd