2016-03-28 50 views
1

nasıl gidiyor? Can sıkıcı bir sorunla karşı karşıyayım. Oluşturmak için html-webpack-plugin tarafından oluşturulan index.html'u bulamıyorum. localhost:8080/index.html adresinden erişebilirim, ancak rotalarımda gidonlarla nasıl oluşturabilirim bilmiyorum.Html web paketi eklentisi tarafından oluşturulan Render dosyası

Ne yapmak isterim: Enjeksiyondan sonra görünümümü bul ve koa-view ve handlebars ile render.

Bütün kodu: https://github.com/vini175pa/koa-redux-starterkit

Yolları: [Birinci link]

Webpack.config.js https://github.com/vini175pa/koa-redux-starterkit/blob/master/webpack.config.js

cevap

1

Belki bunu okuyabilir /blob/master/server/routes/index.js.

https://github.com/jantimon/html-webpack-plugin/issues/145

var express = require('express'); 
var app = express(); 
var webpack = require('webpack'); 
var path = require('path'); 

var compiler = webpack(require('./webpack.config.js')); 

app.use(require('webpack-dev-middleware')(compiler, { 
    noInfo: true, 
    publicPath: '/' 
})); 

app.use('*', function (req, res, next) { 
    var filename = path.join(compiler.outputPath,'index.html'); 
    compiler.outputFileSystem.readFile(filename, function(err, result){ 
    if (err) { 
     return next(err); 
    } 
    res.set('content-type','text/html'); 
    res.send(result); 
    res.end(); 
    }); 
}); 

app.listen(3000);