New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mock-stores

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mock-stores

yet another easy and delightful data mock solutions

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

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

Keywords

mock

FAQs

Package last updated on 13 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts