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
base config should work on manifest #16599
Comments
Vite's manifest only contains mappings of input entry files and output files. |
But in this case, the third party may not know what prefix to start with when reading the manifest. |
Are you talking about an application different from Verdaccio? I thought the server knows the prefix in your use case.
Won't the server need to know the prefix itself rather than the URL for each assets to determine what path the bundle should be served? |
I'm discussing Verdaccio. I want to create a pull request for Verdaccio to support loading custom plugins built with Vite. I believe hardcoding '-/static' is not an elegant solution. |
So changing the manifest to be like the following example won't solve the problem as it'd require the user to configure the base path on Verdaccio side. (If requiring that is fine, then there's no need to add this feature.) {
"main.js": {
"file": "assets/main.4889e940.js",
"src": "main.js",
"url": "/custom-base/assets/main.4889e940.js"
}
} To solve that, we'd need to add a {
"base": "/custom-base/",
"files": {
"main.js": {
"file": "assets/main.4889e940.js",
"src": "main.js"
}
}
} But this is a breaking change. We can avoid wrapping it with an object by putting a special object like below. {
"main.js": {
"file": "assets/main.4889e940.js",
"src": "main.js"
},
"__metadata": {
"base": "/custom-base/"
}
} But this is still a breaking change, because it is normal for the tools that read the manifest to expect all entries in the manifest are file mappings (e.g. the tool may expect all entry to have file field and that file to exist). |
Ah, we can add a new file that contains these kinds of metadata. But that would require a new option for configuring the output path like |
Description
The Webpack manifest supports a publicPath setting like
publicPath: '-/static'
, which allows third-party sites to directly load the application assets by referencing the manifest. For instance, Verdaccio requires custom assets to start with -/static, however, the Vite manifest might not include this specific prefix information.Suggested solution
Add a field in the
ManifestChunk
interface to denote the information, or incorporate the base configuration with a file field.Alternative
No response
Additional context
webpack configuration example:
webpack manifest example:
Validations
The text was updated successfully, but these errors were encountered: