Webpack + koa A message waiting to be packaged wait until bundle finished:

require("babel-register")
const express = require("express")
const webpack = require("webpack")
const webpackConfig = require("./webpack.config")

const app = express()

// webpack
var compiler = webpack(webpackConfig);

// webpack-dev-server
var devMiddleware = require("webpack-dev-middleware")(compiler, {
    publicPath: webpackConfig.output.publicPath,
    stats: {
        colors: true,
        chunks: false
    }
});

app.use(devMiddleware)

// 
app.get("/:viewname?", function(req, res, next) {

    var viewname = req.params.viewname ? req.params.viewname + ".html" : "index.html";

    var filepath = path.join(compiler.outputPath, viewname);

    // webpackoutputFileSystem
    compiler.outputFileSystem.readFile(filepath, function(err, result) {
        if (err) {
            // something error
            return next(err);
        }
        console.log(22222, result)
        res.set("content-type", "text/html");
        res.send(result);
        res.end();
    });
});

module.exports = app.listen(3000)
Mar.02,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c7a1-4ef7f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c7a1-4ef7f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?