Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markthree/vite-layers
layers support for vite,quickly inherit your vite configuration
https://github.com/markthree/vite-layers
framework layers vite
Last synced: 12 days ago
JSON representation
layers support for vite,quickly inherit your vite configuration
- Host: GitHub
- URL: https://github.com/markthree/vite-layers
- Owner: markthree
- License: mit
- Created: 2023-03-28T05:26:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T03:54:32.000Z (10 months ago)
- Last Synced: 2024-11-12T00:12:57.711Z (about 2 months ago)
- Topics: framework, layers, vite
- Language: TypeScript
- Homepage:
- Size: 255 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-layers
layers support for vite,quickly inherit your vite configuration
## Motivation
I want to inherit the configuration of the vite project in workspace and npm
package
## Features
1. [x] inherit configuration file
- [x] npm package
- [x] relative position
## Usage
### install
```shell
npm i vite-layers -D
```### configuration
```ts
// vite.config.ts
import { Layers } from "vite-layers";export default Layers({
// Your own vite configuration now
vite: {
server: {
port: 3000,
},
},
extends: "../vite-vue", // The target directory you want to inherit
});
```#### manual import
```ts
import Config from "../vite-vue/vite.config.ts"; // Manual Import Config
// vite.config.ts
import { Layers } from "vite-layers";export default Layers({
extends: Config, // The target directory you want to inherit
});
```#### multiple
```ts
// vite.config.ts
import Config from "../vite-vue/vite.config.ts"; // Manual Import Config
import { Layers } from "vite-layers";export default Layers({
extends: [
"../../vite-vue",
Config,
], // Multiple target directories to inherit
});
```#### normalize
```ts
// vite.config.ts
import { Layers } from "vite-layers";export default Layers({
normalize(config) {
// Allows you to modify the final configuration
return config;
},
extends: [
"../../vite-vue",
],
});
```#### npm package
```ts
// vite.config.ts
import { Layers } from "vite-layers";export default Layers({
extends: [
"package", // your package
],
});
```
### ts
If you are using TS and there is `tsconfig.node.json`, you need to add types
```json5
{
"compilerOptions": {
"types": ["vite"] // add vite
// ...other content
}
}
```
## inspiration
Inspired by [nuxt/layers](https://nuxt.com/docs/getting-started/layers)
## License
Made with [markthree](https://github.com/markthree)
Published under [MIT License](./LICENSE).