Export @vitejs/plugin-legacy options interface #14931
Labels
contribution welcome
enhancement
New feature or request
p2-nice-to-have
Not breaking anything but nice to have (priority)
plugin: legacy
Description
As a developer building a wrapper library around
@vitejs/plugin-legacy
(nuxt-vite-legacy), I need to re-export the type@vitejs/plugin-legacy
uses to accept user options, because I need to allow a user to configure@vitejs/plugin-legacy
throughnuxt-vite-legacy
.Currently,
@vitejs/plugin-legacy
only exports this:I need it to also export
interface Options
frompackages/plugin-legacy/src/types.ts
:vite/packages/plugin-legacy/src/types.ts
Lines 1 to 5 in 2687dbb
Without that, I have to copy/paste the type into my project, which is not only sub-optimal but also plain wrong. My library supports
@vitejs/plugin-legacy@^4.0
(that is 4.0 and 4.1 at the moment), and the actual version may vary depending on user's project. If I copy/paste the options type from 4.1, this gives false expectations (advertise unsupportedrenderModernChunks
) to users using 4.0, and if I copy/paste the type from 4.0, this will not exposerenderModernChunks
to users that have upgraded to 4.1.Suggested solution
In
packages/plugin-legacy/src/index.ts
we could do:Alternative
No response
Additional context
If it were the application code, I could derive the type with:
However, that only works for the library itself, this doesn't allow to re-export the type for library users.
Validations
The text was updated successfully, but these errors were encountered: