Skip to content

Relative URLs and Static sites don't work in live preview

Summary

When trying to load a static (HTML/CSS/JS) site inside of Live Preview in the Web IDE, relative URLs to assets aren't followed and the preview displays as broken (see screenshots below). The same project loaded directly on Codesandbox works correctly.

Steps to reproduce

Create a project on GitLab and correctly setup a package.json entrypoint for the index.html file. Once loaded the index.html file will load, but no assets referenced via relative URLs work.

Example Project

What is the current bug behavior?

No assets are loaded via relative URLs.

What is the expected correct behavior?

Assets should be loaded via relative URLs

Relevant logs and/or screenshots

GitLab: Screenshot_2020-01-16_11.01.42

Codesandbox: Screenshot_2020-01-16_11.01.49

Possible fixes

It's possible that the version differences of our sandpack scripts create this issue.

Edited by Kai Armstrong