feat: support advanced entrypoints #556
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description 📖
This change adds support for more advanced entrypoints:
Example config for custom names:
Example config for CSS only entrypoint:
Background 📜
At GitLab we have entrypoints that don't necessarily match the filenames. This is due to how we change the entrypoints based on the target release: community edition (CE) or enterprise (EE). EE entrypoints are resolved outside of the
sourceCodeDir
and thus don't match exactly the filename. Also, we use special names for those:pages/foo/bar/index.js
will get a namepages.foo.bar
. As you can see it can not be directly matched to the filename. That's why we need to respect thename
property stored in the manifest and use it instead or the actual filename to resolve an asset.The same thing applies to the stylesheets, we could have different name for these. So we have to resolve CSS entrypoints using
names
property, which as added in vitejs/vite#19912 and released in https://github.com/vitejs/vite/releases/tag/v7.0.0-beta.0.The Fix 🔨
We fix the issue by using
name
andnames
property for entries withisEntry
field. For such entries we create new records in the manifest withname
(or each key innames
) used as a primary key.