0.0.1 • Published 1 year ago

mix-webpack-plugin v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

mix-webpack-plugin

npm version

Motivation

This plugin is inspired by vite-plugin-mix, which help you to write the front-end and back-end API in the single project, this plugin brings you Nextjs DX to your webpack app.

desp

Install

npm i mix-webpack-plugin -D

npm i webpack webpack-cli webpack-dev-server -D

Usage

// webpack.config.js

{
  plugins: [
    // ...
    new MixWebpackPlugin({
      handler: './server/handler.js'
    })
 ],
}
// handler.js
const handler = async (req, res, next) => {
  if (req.path === '/id') {
    res.end('hello world')
    return
  }
  next()
}

module.exports = {handler}

License

MIT @ brandonxiang