-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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: preload paths with different production base path breaks #3061
Conversation
@Holorium would you merge main? There was a fix in the test suite that will give us better error logs for Windows. |
9c567d3
to
2d42d0f
Compare
I just rebased from main. Pipeline looks good now :) |
add test-case which uses a base-path
@Holorium I have tested this PR and I don't think we should do the change. At this point, there is an assumption that if you deploy your app to somewhere different than |
Oh didn't see the comment from patak before |
It actually does not help. We just provide packages and docker containers of our software, but the customers do their on premise installations. Since we only provide parts of the whole software, the customer often use a path based on their branding. So at the time, the code is built, we cannot know the production path and it is unfeasible that the customers build their own packages. |
I see, I don't think this use case is covered by Vite at this point. This counts as a feature to me, and I think this is not the only place where changes would be needed. In my opinion, we need input from Evan here. |
404,我该怎么解决? |
IIUC this is covered by |
Description
If a module is imported dynamically, vite detects modules for preloading and replaces the code with the preload helper. This only affects production builds though.
For example:
is replaced with
Modules are preloaded by injecting a link with rel="modulepreload" in the index.html.
As the /path/to/other.js is absolute, this will only work, if the deployed application runs under "/". If the deployed application is under a different path, the preloading will not work.
This fix just adds a dot in front of the preload url such that it will be load relative to the index.html. I don't see, why that should break anything, but I am not 100% sure.
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).