Skip to content

feat: support advanced entrypoints #556

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CyberAP
Copy link
Contributor

@CyberAP CyberAP commented Jun 5, 2025

Description 📖

This change adds support for more advanced entrypoints:

  1. Entrypoints with custom names that don't match the file name
  2. CSS-only entrypoints

Example config for custom names:

{
  build: {
    rollupOptions: {
      input: {
        'custom-name': '/some-other-file.js'
      }
    }
  }
}

Example config for CSS only entrypoint:

{
  build: {
    rollupOptions: {
      input: {
        'my-style': '/some-style.scss'
      }
    }
  }
}

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 name pages.foo.bar. As you can see it can not be directly matched to the filename. That's why we need to respect the name 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 and names property for entries with isEntry field. For such entries we create new records in the manifest with name (or each key in names) used as a primary key.

1. Entrypoints with custom names that don't match the file name
2. CSS-only entrypoints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant