Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/altipla-consulting/vite-config
[GERRIT]
https://github.com/altipla-consulting/vite-config
Last synced: about 1 month ago
JSON representation
[GERRIT]
- Host: GitHub
- URL: https://github.com/altipla-consulting/vite-config
- Owner: altipla-consulting
- License: mit
- Created: 2021-05-23T00:04:05.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-08-31T06:42:16.000Z (over 3 years ago)
- Last Synced: 2024-08-08T21:51:20.686Z (5 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-config
Configure vite with sane defaults for our projects.
## Install
```sh
npm i @altipla/vite-config
```## Usage
## Applications
Use the exported function from this package to configure the `vite.config.js` file in your project:
```js
import { extendConfig } from '@altipla/vite-config'export default extendConfig()
```## Library mode
To build libraries configure the special mode:
```js
import { extendLibConfig } from '@altipla/vite-config'export default extendLibConfig()
```The default configuration builds a ES module. If you want to customize the outputs to emit the IIFE format for example extend the configuration with a name too:
```js
import { extendLibConfig } from '@altipla/vite-config'export default extendLibConfig({
build: {
lib: {
name: 'example',
formats: ['es', 'iife'],
},
},
})
```Use this library mode with a new `npm run lib` command in the `package.json` scripts section:
```json
{
"scripts": {
"start": "vite",
"build": "echo VITE_VERSION=$BUILD_ID > .env.production && NODE_ENV=production vite build && rm .env.production",
"lib": "echo VITE_VERSION=$BUILD_ID > .env.lib && NODE_ENV=production vite build --mode lib && rm .env.lib"
}
}
```