Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS HMR remove the host in the URL #1665

Closed
RomainLanz opened this issue Jan 23, 2021 · 0 comments
Closed

CSS HMR remove the host in the URL #1665

RomainLanz opened this issue Jan 23, 2021 · 0 comments

Comments

@RomainLanz
Copy link

RomainLanz commented Jan 23, 2021

Hey! 馃憢

When working with CSS, the HMR code of Vite removes the host in the URL.

This may not create an issue when working on a front-end setup, but when integrating with a back-end system like Laravel, Rails, or AdonisJS, it will break the loading of the asset.

This issue only appears in development since after a production build, the assets are served by the back-end.

--

As state per the documentation, we should add the full host to the URL of our assets.

<link rel="stylesheet" href="http://localhost:3000/css/app.css">

After one HMR, this is rewritten like the following.

<link rel="stylesheet" href="/css/app.css">

Therefore, it will not reach Vite server and will fail to load the file.

Related: #1539

@RomainLanz RomainLanz changed the title CSS HMR remove the host for the URL CSS HMR remove the host in the URL Jan 23, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant