vite-fs
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Vite FS

{WIP} Reactive FileSystem for Vite accessable in the client side

NPM version

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

Dependencies (5)

Dev Dependencies (11)

Package Sidebar

Install

npm i vite-fs

Weekly Downloads

23

Version

0.0.2

License

MIT

Unpacked Size

12 kB

Total Files

6

Last publish

Collaborators

  • antfu