Skip to content

Commit ba98c3d

Browse files
itrethanSpaceK33z
authored andcommitted
add an option to config the index path (#123)
1 parent c4f4595 commit ba98c3d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ app.use(webpackMiddleware(webpack({
6262
publicPath: "/assets/",
6363
// public path to bind the middleware to
6464
// use the same as in webpack
65+
66+
index: "index.html",
67+
// the index path for web server
6568

6669
headers: { "X-Custom-Header": "yes" },
6770
// custom headers

middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ module.exports = function(compiler, options) {
218218
var stat = fs.statSync(filename);
219219
if(!stat.isFile()) {
220220
if(stat.isDirectory()) {
221-
filename = pathJoin(filename, "index.html");
221+
filename = pathJoin(filename, options.index || "index.html");
222222
stat = fs.statSync(filename);
223223
if(!stat.isFile()) throw "next";
224224
} else {

0 commit comments

Comments
 (0)