near / chain-deployed-ui

0 stars 0 forks source link

Resolve URL for file at bundle time #27

Open andy-haynes opened 3 weeks ago

andy-haynes commented 3 weeks ago

On-chain assets need to have their path specified such that they are URL-resolvable.

Currently <script src="assets/index.js" /> works as a reference to /author.near/assets.index.js, ostensibly due to URL hierarchy rules. However the same code with a leading / (src="/assets/index.js") fails since the path is relative to the domain, and ends up omitting the author.near/ prefix.

Truncating the leading / could be a viable option here, though the same logic would need to be applied within bundles; i.e. when a bundle references a relative svg path.

This all assumes that all assets are going on-chain. Differentiating on-chain vs externally-hosted assets is a separate issue 😅