Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elonehoo/vite-plugin-package-configs
Extend Vite config from package.json field
https://github.com/elonehoo/vite-plugin-package-configs
config vite vite-plugin
Last synced: 14 days ago
JSON representation
Extend Vite config from package.json field
- Host: GitHub
- URL: https://github.com/elonehoo/vite-plugin-package-configs
- Owner: elonehoo
- License: mit
- Created: 2023-02-05T09:14:05.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T19:36:49.000Z (14 days ago)
- Last Synced: 2024-11-05T20:36:10.178Z (14 days ago)
- Topics: config, vite, vite-plugin
- Language: CSS
- Homepage: https://www.npmjs.com/package/vite-plugin-package-configs
- Size: 400 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-package-configs
[![NPM version](https://img.shields.io/npm/v/vite-plugin-package-configs?color=a1b858&label=)](https://www.npmjs.com/package/vite-plugin-package-configs)
Extend Vite config from your package.json `vite` field.
```jsonc
// package.json
{
"vite": {
"resolve": {
"alias": {
"~/": "src/"
}
},
"build": {
"output": "dist/"
}
}
}
```## Install
```bash
npm i -D vite-plugin-package-configs
```Add plugin to your `vite.config.ts`:
```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:- [antfu/vite-plugin-package-config](https://github.com/antfu/vite-plugin-package-config)
## License
[MIT](./LICENSE) License © 2023 [Elone Hoo](https://github.com/elonehoo)