Skip to content

feat: custom base path#24

Open
pwuersch wants to merge 1 commit into
b310-digital:masterfrom
pwuersch:feat/custom-base-path
Open

feat: custom base path#24
pwuersch wants to merge 1 commit into
b310-digital:masterfrom
pwuersch:feat/custom-base-path

Conversation

@pwuersch
Copy link
Copy Markdown

@pwuersch pwuersch commented Oct 1, 2025

This adds a custom base path option to the Dockerfile. By specifying the BASE_PATH build argument when building the Dockerfile, the Vite build step will use this path as the root for all assets and generated bundles.

By default, the root will remain as /, which is the same as now. The only minor change is the assumption of Bash variables in the excalidraw-app/package.json's build:app:docker script, but because I assume it's mostly used for building with Docker, that's a safe assumption to make.

@pwuersch pwuersch changed the title feat: custom build path feat: custom base path Oct 1, 2025
@pwuersch pwuersch force-pushed the feat/custom-base-path branch from f45664c to 5921f67 Compare October 1, 2025 21:38
@JannikStreek
Copy link
Copy Markdown
Member

Thanks for the PR! Just to understand this better, what is the use case to configure this?

@pwuersch
Copy link
Copy Markdown
Author

pwuersch commented Oct 7, 2025

Thanks for the PR! Just to understand this better, what is the use case to configure this?

We are deploying this application on a subpath like example.com/apps/excalidraw. For the frontend to load the assets accordingly, the Vite build step needs to be set to the correct URL. By default, this Excalidraw's Vite configuration assumes all the files are relative to the root /. This then breaks our use case because, e.g., our generated Excalidraw assets are actually located at example.com/apps/excalidraw/assets.

With this change, the BASE_PATH build arg can be set to (in our case) /apps/excalidraw during the container build, which adds this prefix to all resource URLs in places like the generated index.html. This way, the URLs end up as /apps/excalidraw/assets/….

This does not change the current behavior for anyone omitting the BASE_PATH container build argument because of its default value of /, which is in line with the Vite defaults used in this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants