Skip to content

Repository files navigation

midori-webpack

Combine midori and webpack ❤️.

build statuscoveragelicenseversiondownloads

If you're serving webpack assets or need to attach information about your webpack assets to your midori request handler then you can use midori-webpack to do just that. Usage is simple and also supports development mode using both webpack-dev-server and webpack-udev-server.

Usage

npm install --save midori-webpack

Simple example:

import{compose,request,send,get}from'midori';import{withStats,serveStatic}from'midori-webpack';constisDev=process.env.NODE_ENV==='development'||!process.env.NODE_ENV;constcreateApp=compose(// Attach `stats` to the `request` object. This can be a URL if you're using// `webpack-dev-server` since nothing is generated on the local filesystem.// If you're using `webpack-udev-server` then everything is handled for you// internally and you can just use the normal filename.withStats(isDev ? 'http://localhost:8080/js/stats.json' : './dist/stats.json'),// Serve all your webpack assets with the correct `publicPath`. This assumes// all your generated assets live in the same folder as your `stats.json`.serve('./dist/stats.json'),// Dump the stats for fun.get('/stats',request((req)=>{returnsend(JSON.stringify(req.stats));})),);constapp=createApp();app.listen(8888);

You can find a complete example including instructions on how to run it in various modes in the [demo] folder.

About

Add `webpack` powers to your `midori` app.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages