c12 icon indicating copy to clipboard operation
c12 copied to clipboard

Support vite(6) as config loader

Open pi0 opened this issue 1 year ago • 3 comments

Describe the feature

(context: quickly talking with @yyx990803)

Vite 6 with environment API allows loading ts config files similar to jiti.

We can optionally support vite as a config loader for .ts support, faster resolutions, custom plugins, etc.

/cc @danielroe @antfu @patak-dev would love to hear your early thoughts!

Additional information

  • [X] Would you be willing to help implement this feature?

pi0 avatar Nov 13 '24 11:11 pi0

cc @sheremet-va

  • https://github.com/vitejs/vite/pull/18637

patak-dev avatar Nov 13 '24 22:11 patak-dev

We had an idea to expose this as a function like “import” (inlines the environment when called, not good for performance or memory to be honest 👀) and possibly introduce “vite run” command in the future.

sheremet-va avatar Nov 13 '24 22:11 sheremet-va

@sheremet-va Maybe it could be coupled with an unimport() API (mimicking clear require.cache) that allows to free-up memory? We probably need something similar to also allow reloading config same as jiti with disabled cache.

pi0 avatar Nov 14 '24 09:11 pi0