Comments (6)
Vite's manifest only contains mappings of input entry files and output files.
Why does the base
need to be included in manifest? I suppose you can calculate the URL with '/-/static/' + manifest[entry].file
.
from vite.
Vite's manifest only contains mappings of input entry files and output files. Why does the
base
need to be included in manifest? I suppose you can calculate the URL with'/-/static/' + manifest[entry].file
.
But in this case, the third party may not know what prefix to start with when reading the manifest.
This should be a black box, where third parties only need to know that resources can be obtained based on the manifest, right?
from vite.
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.
This should be a black box, where third parties only need to know that resources can be obtained based on the manifest
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?
from vite.
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.
from vite.
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
field. But given that the manifest contains the file mapping in the top level, we'd need to wrap that with an object to put the new base
field.
{
"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).
I guess we need a strong benefit to do this.
from vite.
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 build.manifest
. It's also possible to implement that by a plugin.
from vite.
Related Issues (20)
- issue with npm run dev, "[ERROR] Must use "outdir" when there are multiple input files" HOT 3
- Source maps in VSCode not working for debug if white space is in url HOT 1
- Cannot read properties of null (reading 'useState')
- `waitForRequestsIdle` hangs indefinitely when used in a Nuxt project HOT 1
- Adding optimizeDeps and commonjsOptions breaks unrelated imports during build process HOT 1
- Builds Fail with Lightning CSS Minifier and ES2023 Target HOT 8
- `CSSOptions.preprocessorOptions` is missing types HOT 4
- [Bug] Dev server resolves wrong module for provided ETag, leading to stale content HOT 1
- Identical Code Builds on Linux and Fails on Windows HOT 1
- Update esbuild dependency for vulnerability scanners HOT 1
- vs code debugging vite+vue3 project breakpoints cannot point to source code HOT 2
- Vite cli swallows thrown errors HOT 1
- Conditional exports can't be active when key is `browser` HOT 1
- vite.config.ts Can't import ESM if it's a .js file
- When the "node" condition path in exports is null vite build will wrongly throw a "No known conditions for" error HOT 1
- Dynamic import not working as expected with base public path option. HOT 5
- Qwik template doesn't build HOT 1
- In production build asset location is not getting resolve HOT 1
- vite can not get cookie from set-cookie HOT 3
- Allow plugins to hook into `preprocessCSS()` HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite.