[PR #1746] [CLOSED] Switch to nuxt server and apply base path #3615

Closed
opened 2026-04-25 00:16:22 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/1746
Author: @1nVitr0
Created: 5/1/2023
Status: Closed

Base: masterHead: feature/nuxt-target-server


📝 Commits (10+)

  • 883cb46 Merge commit '5286b533347477ae47d4e56f086285019e8095c1' into feature/nuxt-target-server
  • 31dc10b Add: build client as server instead of static
  • eecd8be Update: run client from server and proxy requests
  • 7d0401f CI: update docker image for nuxt server target
  • 634167a Remove sortablejs
  • 57994ff Only start ClientRouter for production
  • a8b7c56 Fix: server nuxt client directly without proxy
  • 9a777a8 Style: fix bookshelf texture url
  • 3c73322 Dependencies: remove http-proxy-middleware
  • 433876f Chore: clean up unnecessary arguments

📊 Changes

31 files changed (+18091 additions, -14886 deletions)

View changed files

📝 .dockerignore (+5 -0)
📝 .github/workflows/integration-test.yml (+2 -2)
📝 .gitignore (+1 -0)
📝 Dockerfile (+13 -6)
📝 client/assets/app.css (+1 -1)
📝 client/components/app/ConfigSideNav.vue (+5 -5)
📝 client/components/app/SideRail.vue (+5 -5)
📝 client/components/covers/AuthorImage.vue (+1 -1)
📝 client/components/modals/player/QueueItemRow.vue (+1 -1)
📝 client/components/modals/rssfeed/OpenCloseModal.vue (+1 -1)
📝 client/components/readers/EpubReader.vue (+14 -14)
client/esbuild.js (+17 -0)
client/esm-shims.js (+7 -0)
📝 client/layouts/default.vue (+2 -1)
client/modules/rewritePwaManifest.js (+54 -0)
client/nitro.entry.js (+17 -0)
client/nitro.preset.js (+7 -0)
📝 client/nuxt.config.js (+51 -24)
📝 client/package-lock.json (+17789 -14750)
📝 client/package.json (+14 -13)

...and 11 more files

📄 Description

Adresses #385, expanding on #1724

Updating nuxt to a server target went fairly well, although polishing (as always) revealed some quirks of nuxt:

  • The dynamic base path only works when specifying router base ./ at build time
  • The dynamic router base path is incompatible with @nuxt/pwa, so some open heart surgery was needed, thugh significantly more robust than the original pull request #1724
  • Nuxt inserts all nodes specified in nuxt.config.js => header BEFORE the <base> tag containing the router base path. This means, both Sortable lib and the favicon are not dynamic. I have created plugins for both of them (sortable, favicon), which I'm not very happy about. Especially loading the favicon after the scripts is not ideal.
  • The client must be run using nuxt start, I have not been able to get the supposed --standalone mode to work, so the client dependencies are necessary

In it's current state, it has been working throughout my local tests. I did run the same tests in the docker image, where for some reason the icon.svg as well as the Sortable.js lib return 404 errors. Not sure what the issue is here, but I've been staring at this for too long, probably just missing something simple.

In case you're wondering about the order changes in the Dockerfilec, this was mainly done for cache efficiency. I had the client dependencies install again every time I fiddled with the nuxt.config.js, so I split copying the package.json and the rest of the code. Similar deal with the other copy commands, I tried ordering from least to most often changed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/1746 **Author:** [@1nVitr0](https://github.com/1nVitr0) **Created:** 5/1/2023 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/nuxt-target-server` --- ### 📝 Commits (10+) - [`883cb46`](https://github.com/advplyr/audiobookshelf/commit/883cb46481ebc31c422d53f8a1ef90c8ef2c211a) Merge commit '5286b533347477ae47d4e56f086285019e8095c1' into feature/nuxt-target-server - [`31dc10b`](https://github.com/advplyr/audiobookshelf/commit/31dc10ba514ecaa6d92d94a149070b43d13a3e50) Add: build client as server instead of static - [`eecd8be`](https://github.com/advplyr/audiobookshelf/commit/eecd8be78d311926aa6ce0aea1dde2045112a3c8) Update: run client from server and proxy requests - [`7d0401f`](https://github.com/advplyr/audiobookshelf/commit/7d0401f463eed4bf6c2da842c10d227b6c30d2b9) CI: update docker image for nuxt server target - [`634167a`](https://github.com/advplyr/audiobookshelf/commit/634167aea645506cd63b99575ad517fbc42146c1) Remove sortablejs - [`57994ff`](https://github.com/advplyr/audiobookshelf/commit/57994ffb5bde08b4fa3a0914504eb56a66b5bc9f) Only start ClientRouter for production - [`a8b7c56`](https://github.com/advplyr/audiobookshelf/commit/a8b7c56bec3ad1609584f49e809cd2082e53d27d) Fix: server nuxt client directly without proxy - [`9a777a8`](https://github.com/advplyr/audiobookshelf/commit/9a777a8b1881458abdaa76eeef8a2aa925ecadf2) Style: fix bookshelf texture url - [`3c73322`](https://github.com/advplyr/audiobookshelf/commit/3c73322fc14e40b896b8cea4b93af8d5d8ffde2b) Dependencies: remove http-proxy-middleware - [`433876f`](https://github.com/advplyr/audiobookshelf/commit/433876f724c6a503a442e019591961c7e10ac151) Chore: clean up unnecessary arguments ### 📊 Changes **31 files changed** (+18091 additions, -14886 deletions) <details> <summary>View changed files</summary> 📝 `.dockerignore` (+5 -0) 📝 `.github/workflows/integration-test.yml` (+2 -2) 📝 `.gitignore` (+1 -0) 📝 `Dockerfile` (+13 -6) 📝 `client/assets/app.css` (+1 -1) 📝 `client/components/app/ConfigSideNav.vue` (+5 -5) 📝 `client/components/app/SideRail.vue` (+5 -5) 📝 `client/components/covers/AuthorImage.vue` (+1 -1) 📝 `client/components/modals/player/QueueItemRow.vue` (+1 -1) 📝 `client/components/modals/rssfeed/OpenCloseModal.vue` (+1 -1) 📝 `client/components/readers/EpubReader.vue` (+14 -14) ➕ `client/esbuild.js` (+17 -0) ➕ `client/esm-shims.js` (+7 -0) 📝 `client/layouts/default.vue` (+2 -1) ➕ `client/modules/rewritePwaManifest.js` (+54 -0) ➕ `client/nitro.entry.js` (+17 -0) ➕ `client/nitro.preset.js` (+7 -0) 📝 `client/nuxt.config.js` (+51 -24) 📝 `client/package-lock.json` (+17789 -14750) 📝 `client/package.json` (+14 -13) _...and 11 more files_ </details> ### 📄 Description Adresses #385, expanding on #1724 Updating nuxt to a server target went fairly well, although polishing (as always) revealed some quirks of nuxt: - The dynamic base path only works when specifying router base `./` at build time - The dynamic router base path is incompatible with `@nuxt/pwa`, so some [open heart surgery](https://github.com/1nVitr0/audiobookshelf/blob/feature/nuxt-target-server/client/modules/rewritePwaManifest.js) was needed, thugh significantly more robust than the original pull request #1724 - Nuxt inserts all nodes specified in `nuxt.config.js` => `header` **BEFORE** the `<base>` tag containing the router base path. This means, both `Sortable` lib and the `favicon` are not dynamic. I have created plugins for both of them ([sortable](https://github.com/1nVitr0/audiobookshelf/blob/feature/nuxt-target-server/client/plugins/sortable.js), [favicon](https://github.com/1nVitr0/audiobookshelf/blob/feature/nuxt-target-server/client/plugins/favicon.js)), which I'm not very happy about. Especially loading the favicon after the scripts is not ideal. - The client must be run using `nuxt start`, I have not been able to get the supposed [`--standalone`](https://nuxtjs.org/docs/configuration-glossary/configuration-build/#standalone) mode to work, so the client dependencies are necessary In it's current state, it has been working throughout my local tests. I did run the same tests in the docker image, where for some reason the `icon.svg` as well as the `Sortable.js` lib return 404 errors. Not sure what the issue is here, but I've been staring at this for too long, probably just missing something simple. In case you're wondering about the order changes in the Dockerfilec, this was mainly done for cache efficiency. I had the client dependencies install again every time I fiddled with the `nuxt.config.js`, so I split copying the `package.json` and the rest of the code. Similar deal with the other copy commands, I tried ordering from least to most often changed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:16:22 +02:00
adam closed this issue 2026-04-25 00:16:22 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3615