0.2.3 • Published 12 months ago

vite-plugin-off-line-data v0.2.3

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

vite-plugin-off-line-data

A Vite plugin.

Installation

npm install vite-plugin-off-line-data

use

vite.config.js

import vitePluginOffLineData from 'vite-plugin-off-line-data';

export default {
  ...
  plugins: [
    vitePluginOffLineData({
      outDir: 'mock', // 
      ignoreParameter: true, // ignore url param [Boolean | Function | Array]
      include: ['/api', '/api1/v1'],  // [(url)=>Boolean | Array | String]
      requestPayload: {
        '/api/v1/request1': 'arg1',
        '/api/v1/request2': ['arg1', 'arg2', 'arg3'],
        '/api/v1/request3': []
      },
      mode: 'read', // record | read
      autoNext: false
    })
  ]
}

Mock Data

eg: /api/v1/request/method.json | js

{ contentType? : default = 'application/json' contentEncoding? contentDisposition? transferEncoding? statusCode? : default = 200 body? : json | string bodyPath? stream? : Boolean }

js

module.exports = function({ payload }){ return { body: 'eg' } }

0.2.3

12 months ago

0.2.2

12 months ago

0.2.1

12 months ago

0.2.0

12 months ago

0.0.2

1 year ago

0.0.1

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago