0.0.2 • Published 4 years ago
vite-fs v0.0.2
Vite FS
{WIP} Reactive FileSystem for Vite accessable in the client side
Install
npm i -D vite-fs
// vite.config.js
import Vue from '@vitejs/plugin-vue'
import ViteFS from 'vite-fs'
export default {
plugins: [
Vue(),
ViteFS()
]
}
// shim-fs.d.ts
import { ref } from 'vue'
declare module '*.json.ref' {
const content: Ref<any>
export default content
}
declare module '*.ref' {
const content: Ref<string>
export default content
}
Usage
Suffix .ref
to path you'd like to import, for example
import data from '../data.json.ref'
// the type of `data` will be `Ref<any>`
// `data` will bind to `data.json` magically on dev
data.value.x = 10
// `data.json` will be updated
Sponsors
This project is part of my Sponsor Program
License
MIT License © 2020 Anthony Fu