vite-plugin-package-configs
v0.0.12
Published
Extend Vite config from package.json field
Downloads
79
Readme
vite-plugin-package-configs
Extend Vite config from your package.json vite
field.
// package.json
{
"vite": {
"resolve": {
"alias": {
"~/": "src/"
}
},
"build": {
"output": "dist/"
}
}
}
Install
npm i -D vite-plugin-package-configs
Add plugin to your vite.config.ts
:
// vite.config.ts
import PKG from 'vite-plugin-package-configs'
export default {
plugins: [
PKG()
]
}
why
Well, I know you can always have those configurations in your vite.config.ts
file. But, aware the file is in JavaScript / TypeScript, it is not that friendly to be statically analyzed. By putting some of the static configurations in your package.json
file, you can have it shareable for other scripts and tools (or even manipulate it) by simply loading and parsing the JSON file.
Credits
Thanks to: