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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: scripts and styles were missing from built HTML on Windows #16421

Merged
merged 3 commits into from May 1, 2024

Conversation

rse
Copy link
Contributor

@rse rse commented Apr 13, 2024

Description

Fix HTML entry file generation under Windows where different path
separation characters exists than on POSIX filesystems. This fixes issue
#15992.

The bug was not present in Vite 5.0.12, but still exists in 5.2.8.
I've traced it down to a bug in Vite which is related to path
handling and manifests itself only under Windows filesystems. The
chunk.facadeModuleId is something like C:\Users\rse\xxx\index.html
(the Windows path separation characters are in place) and the id is
C:/Users/rse/xxx/index.html (where POSIX path separation characters
are in place). As a result, the chunk is not found and hence the
tags not emitted during the HTML generation.

The workaround by using path.resolve() on the
build.rollupOptions.input works, but it would be better if the
comparison inside Vite is fixed. This is what this PR attempts to do.

…aration characters exists than on POSIX filesystems (this fixes vitejs#15992)
Copy link

stackblitz bot commented Apr 13, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red added windows only has workaround p2-edge-case Bug, but has workaround or limited in scope (priority) feat: build labels Apr 14, 2024
@sapphi-red sapphi-red changed the title fix HTML entry file generation under Windows where different path separation characters exists than on POSIX filesystems fix: scripts and styles were missing from built HTML on Windows Apr 30, 2024
@sapphi-red sapphi-red added the regression The issue only appears after a new release label Apr 30, 2024
@sapphi-red
Copy link
Member

I applied my changes so that it works and added a test.

@sapphi-red
Copy link
Member

/ecosystem-ci run

@patak-dev patak-dev merged commit 0e93f58 into vitejs:main May 1, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: build has workaround p2-edge-case Bug, but has workaround or limited in scope (priority) regression The issue only appears after a new release windows only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants