Skip to content

Webpack Quick Start

1. Install

bash
pnpm add -D mokup
bash
npm install -D mokup
bash
yarn add -D mokup
bash
bun add -d mokup

2. Add the plugin

js
const { mokupWebpack } = require('mokup/webpack')

const withMokup = mokupWebpack({
  entries: {
    dir: 'mock',
    prefix: '/api',
  },
})

module.exports = withMokup({})

3. Start dev server

Run your webpack dev server:

bash
pnpm webpack serve
bash
npm exec webpack serve
bash
yarn webpack serve
bash
bunx webpack serve

4. Verify

  • http://localhost:8080/api/users
  • http://localhost:8080/__mokup

Next

See the full options in Webpack Plugin.