https://github.com/zebp/vite-plugin-const
Compile time evaluation for Vite
https://github.com/zebp/vite-plugin-const
Last synced: about 2 months ago
JSON representation
Compile time evaluation for Vite
- Host: GitHub
- URL: https://github.com/zebp/vite-plugin-const
- Owner: zebp
- License: mit
- Created: 2023-10-07T18:51:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-13T15:22:28.000Z (about 1 year ago)
- Last Synced: 2025-04-02T05:49:36.730Z (about 2 months ago)
- Language: TypeScript
- Size: 40 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vite-plugin-const
A Vite plugin for compile-time execution of ESM modules.## Installation
```bash
# NPM
$ npm install --save-dev vite-plugin-const
# Yarn
$ yarn add -D vite-plugin-const
# PNPM
$ pnpm add -D vite-plugin-const
# Bun
$ bun add -D vite-plugin-const
```## Usage
Depending on what framework you are using your configuration will look slightly different. If you
are using a [Webpack](https://webpack.js.org/) based framework you should instead look towards
[const-module-loader](https://github.com/zebp/const-module-loader), which is the same functionality
but for Vite based frameworks.### Vite
Most frameworks will use the regular `vite.config.js` file where you can register the plugin like:
```js
import constPlugin from "vite-plugin-const";export default defineConfig({
plugins: [constPlugin()],
});
```## License
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.