0.0.6 • Published 2 months ago

mock-stores v0.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
2 months ago

Introuced

GitHub issuesGitHub forksGitHub starsGitHub license

Mock-Stores help you to mock data easily at anywhere with webpack.providePlugin

Install

$ yarn add mock-stores -D

Usage

firstly,create mock directory in your root directory, and then create your js/json file. Add this plugin in webpack.config.js file

// webpack.config.js
  plugins: [
    new webpack.ProvidePlugin({
      Store: 'mock-stores'
  })

just add Store object in where you get data, and in development environment you will get mock data,and in production environment ,you get online data.You don't have to do anything, enjoy it!

 fetch('/users.json')
   .then(function(response) {
     let item = Store['yourMockJsFileName'] || response.json()
   })  

LICENSE

MIT ©hawx1993

0.0.5

2 months ago

0.0.6

2 months ago

0.0.4

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago