Skip to content
PluginStats

mock-service-plugin weekly downloads statistics

By bianliuzhu · npm · Webpack plugins

Simulated backend interface service

View on npm Stale · Oct 17, 2026

mock-service-plugin has 15 recorded weekly downloads on npm, a decrease of 71.2% over the past 30 days, ranking #1872 of 2,256 tracked listings.

Weekly downloads
15
Official API · Oct 17, 2026
7-day growth
-93.7%
-224 weekly downloads
30-day growth
-71.2%
-37 weekly downloads
90-day growth
+400%
+12 weekly downloads
Rank
#1872
Among tracked npm listings

About mock-service-plugin

mock-service-plugin

English | 中文

A powerful local Mock service plugin that supports Webpack, Vite, and other mainstream build tools — letting you develop and debug frontend pages even before the backend APIs are ready.

Table of Contents

• What is Mocking? • Features • Installation • 5-Minute Quick Start • Mock File Specification • MockJS Syntax Reference • Supported File Formats • Full Format Examples • Advanced Features • Framework Integration • Debug Interface • FAQ • Example Projects

What is Mocking?

In real-world development, frontend and backend teams often work in parallel. When the backend APIs aren't ready yet, the frontend has no data to work with and development stalls.

Mocking means running a fake backend service locally that returns dummy data according to the agreed API contract, so frontend development can proceed independently without relying on a real backend.

What mock-service-plugin does is: read your mock data files, automatically start a local HTTP server, and return the corresponding data when frontend requests come in.

Features

• 🚀 Supports multiple build tools: Webpack 4/5, Vite, Vue CLI, Create React App • 🎯 Compatible with Vue, React, and other mainstream frameworks • 🔥 Feature-rich • RESTful API support (GET / POST / PUT / DELETE, etc.) • Dynamic route parameters (e.g. /api/users/:id) • Streaming responses (SSE / EventStream, simulates AI typewriter effect) • Multiple response formats (JSON / XML / CSV / Image / Plain text, etc.) • 💡 Minimal configuration, hot reload, built-in debug interface

Installation

5-Minute Quick Start

The following uses a Vite + Vue project as an example to walk you through your first Mock API from scratch.

Step 1: Install the Plugin

Step 2: Create the Mock Directory and File

Create a mocks folder in the project root and add a file mocks/user.json:

Contents of mocks/user.json:

The /** ... */ comment at the top is the route configuration, telling the plugin which API path and HTTP method this file corresponds to. @cname, @email, etc. are MockJS random data placeholders — each request generates different random data. See MockJS Syntax Reference for full syntax.

Step 3: Start the Mock Service in Vite

Create vite-mock-plugin.ts in the project root:

Update vite.config.ts:

Add a mock start script to package.json:

Step 4: Start and Test

After starting, open http://localhost:3008/api/user/info in your browser and you'll see randomly generated user data:

Congratulations! You've successfully set up your first Mock API. 🎉

Mock File Specification

File Structure

Each mock file consists of two parts:

Annotation Reference

| Annotation | Required | Description | Example |

| @url | ✅ Yes | API path, supports dynamic parameters | @url /api/users/:id | | @method | Optional | HTTP method, defaults to GET | @method POST | | @content-type | Optional | Override the default Content-Type. Preferably use the file extension as reference — see Supported File Formats. | @content-type image/png |

Dynamic Route Parameters

Use :paramName to define dynamic path segments:

Both /api/users/123 and /api/users/456 will match this file.

Managing Multiple APIs in One Directory

It's recommended to organize files by business module:

The plugin recursively scans the entire mocks directory and automatically registers all routes found in every file.

MockJS Syntax Reference

MockJS is a data mocking library that generates random data using template syntax. The plugin bundles MockJS, so it can be used directly in .json mock files.

VS Code Completion Extension

For a better template editing experience, use Mock.js Completion, a companion VS Code extension that provides MockJS placeholder and parameter completion.

• Install: Requires VS Code 1.85.0 or later. Search for bianliuzhu.mockjs-completion in the Extensions view and install it, or run code --install-extension bianliuzhu.mockjs-completion. • Use: Open your project root in VS Code and edit a .json file under mocks/ (including subdirectories). Type @ inside a string value to see suggestions such as @cname, @email, and @integer; use Tab to move between parameters after accepting a suggestion. • Language mode: For files with top-of-file route annotations, select JSON with Comments (JSONC) while keeping the .json extension. The response body must still be valid JSON, without comments or trailing commas.

This optional extension only assists with template editing. It does not install or start mock-service-plugin; custom mock directories outside the workspace-root mocks/ folder and .sse files are not supported by the extension.

Random Value Placeholders

See Full Syntax Categories

| Syntax | Description | Example Output |

| @id | Random ID number | "420000199206230937" | | @guid | Random GUID | "662C63B4-FD43-66F4-3328" | | @cname | Random Chinese name | "Wang Fang" | | @name | Random English name | "Charles Lopez" | | @email | Random email address | "x.fwtue@pbgty.com" | | @url | Random URL | "http://ljwih.io/lxqf" | | @ip | Random IP address | "52.249.14.3" | | @integer(min, max) | Random integer in range | @integer(1, 100) → 42 | | @float(min, max, dMin, dMax) | Random float | @float(1, 100, 2, 2) → 36.14 | | @boolean | Random boolean | true or false | | @date | Random date | "2021-07-30" | | @datetime | Random datetime | "2021-07-30 10:42:01" | | @now | Current time | "2026-03-27 14:22:00" | | @csentence(min, max) | Random Chinese sentence | "学中用称化置速。" | | @ctitle(min, max) | Random Chinese title | "Sample Product Name" | | @cparagraph | Random Chinese paragraph | A paragraph of random Chinese text | | @image('WxH') | Random placeholder image URL | @image('200x100') | | @pick(['a','b','c']) | Pick one item randomly from array | "b" | | @increment(1) | Auto-incrementing number (starts at 1) | 1, 2, 3... | | @string('lower', 8) | Random string | "abcdefgh" |

Generating Arrays (Bulk Data)

Append |count to a field name to generate an array:…

Description from the npm listing.

  • mock
  • mockjs
  • webpack-plugin
  • mock service
  • json server

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

mock-service-plugin weekly downloads on npm, last 90 days: 15 weekly downloads as of Oct 17, 2026, +400% over 90 days.mock-service-pluginWeekly downloads on npm · Last 90 days15downloads / week+400% over 90 days050100150200250Jul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 17, 2026 · 88 observations · Updated Oc…pluginstats.com
mock-service-plugin weekly downloads on npm, last 90 days: 15 weekly downloads as of Oct 17, 2026, +400% over 90 days.

7/30/90-day growth

mock-service-plugin weekly downloads growth on npm: -93.7% over 7 days, -71.2% over 30 days, +400% over 90 days.mock-service-pluginWeekly downloads growth on npm15downloads / week now7-day growth-224 weekly downloads-93.7%30-day growth-37 weekly downloads-71.2%90-day growth+12 weekly downloads+400%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
mock-service-plugin weekly downloads growth on npm: -93.7% over 7 days, -71.2% over 30 days, +400% over 90 days.

Ranking history

mock-service-plugin npm ranking history: currently #1872 (by weekly downloads).mock-service-pluginnpm ranking · by weekly downloads · Last 90 days#1872current rank#1864#1866#1868#1870#1872#1874Jul 21Aug 5Aug 20Sep 4Sep 19Oct 4Oct 19rankOct 18, 2026 – Oct 19, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
mock-service-plugin npm ranking history: currently #1872 (by weekly downloads).

Listing placement

All npm2,256 listings · 113 pages · 1,129 shown · page 94, #13 (overall #1,873)
All npm: every listing in weekly downloads order

Listing placement

Webpack plugins247 listings · 13 pages · page 9, #16 (overall #176)
Webpack plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (121)
Recent weekly downloads observations for mock-service-plugin
Date (UTC)Weekly downloadsChange vs. previous
15-16
31-170
201-1
202-2
2040
204-40
244+5
239+15
224+175
49+1
48+1
470
47+44
3—

Similar npm Webpack plugins plugins

All 20 mock-service-plugin alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/mock-service-plugin. First seen Oct 16, 2026; last successful collection Oct 19, 2026. See the methodology.