Skip to content

feat: Respect Vite base for linking asset placeholders#839

Merged
justinvdm merged 1 commit intoredwoodjs:mainfrom
Toolbase-AI:gching/respect-vite-base
Oct 23, 2025
Merged

feat: Respect Vite base for linking asset placeholders#839
justinvdm merged 1 commit intoredwoodjs:mainfrom
Toolbase-AI:gching/respect-vite-base

Conversation

@gching
Copy link
Copy Markdown
Contributor

@gching gching commented Oct 23, 2025

Ref #837

This PR adds in support for the Vite base for the linker for asset placeholders. This is needed since in the current second workers linker build, we are statically replacing asset placeholders to final paths that don't respect this base setting

Not a main contributor, so this might be the wrong spot. Let me know if this logic should be elsewhere

Changes

  • Store reference to config
  • Pass in base to linkWorkerBundle to prepend if it exists
  • Simple tests

Before change

With Vite base = https://example.com/

// Before linking
const stylesheet = "rwsdk_asset:/src/styles.css";
const logo = "rwsdk_asset:/src/logo.svg";

// After linking
// Note not including the base
const stylesheet = "/assets/styles.123.css"
const logo = "/assets/logo.abc.svg"

After change

With Vite base = https://example.com

// Before linking
const stylesheet = "rwsdk_asset:/src/styles.css";
const logo = "rwsdk_asset:/src/logo.svg";

// After linking
// Note not including the base
const stylesheet = "https://example.com/assets/styles.123.css"
const logo = "https://example.com/assets/logo.abc.svg"

@justinvdm
Copy link
Copy Markdown
Collaborator

Thank you @gching, this looks solid! Merging and releasing

@justinvdm justinvdm merged commit 36d6011 into redwoodjs:main Oct 23, 2025
5 checks passed
@gching gching deleted the gching/respect-vite-base branch October 23, 2025 02:36
@justinvdm
Copy link
Copy Markdown
Collaborator

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