Description
current, defineConfig type definition allow to write root only option(e.g. run.enablePrePostScripts) to package. but actually, it does not works. this problem is not good of developer experience.
Suggested solution
Add "definePackageConfig" and "defineRootConfig" function. this will be exported by "vite-plus". "defineRootConfig" is just alias of "defineConfig" but "definePackageConfig" has new type definition.
code example
// workspace/packages/main/vite.config.ts
// this is package's config file.
import { definePackageConfig } from "vite-plus"
export default definePackageConfig({
run: {
enablePrePostScripts:true // happen type error because run.enablePrePostScripts is root only option
}
})
// workspace/vite.config.ts
// this is root's config.
import { defineRootConfig } from "vite-plus"
export default defineRootConfig({
run: {
enablePrePostScripts:true // does not happen type error.
}
})
also, this is just coding rules. no one can stop to use "defineConfig" or "defineRootConfig" in package's vite.config.ts.
this proposal make "defineConfig" deprecated and recommend use new function.
Alternative
Add more readable jsdoc e.g. "@Root-only - this option does not work on package's config". but probably, developer will fail to notice.
Additional context
No response
Validations
Description
current, defineConfig type definition allow to write root only option(e.g. run.enablePrePostScripts) to package. but actually, it does not works. this problem is not good of developer experience.
Suggested solution
Add "definePackageConfig" and "defineRootConfig" function. this will be exported by "vite-plus". "defineRootConfig" is just alias of "defineConfig" but "definePackageConfig" has new type definition.
code example
also, this is just coding rules. no one can stop to use "defineConfig" or "defineRootConfig" in package's vite.config.ts.
this proposal make "defineConfig" deprecated and recommend use new function.
Alternative
Add more readable jsdoc e.g. "@Root-only - this option does not work on package's config". but probably, developer will fail to notice.
Additional context
No response
Validations