Skip to content

Commit fb440b2

Browse files
committed
Fix contentBase taking preference over in-memory files
Also, the test I wrote earlier was not correct. Ref #640
1 parent ca2251e commit fb440b2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Server.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ function Server(compiler, options) {
226226
if(options.historyApiFallback) {
227227
// Fall back to /index.html if nothing else matches.
228228
app.use(
229-
historyApiFallback(typeof options.historyApiFallback === "object" ? options.historyApiFallback : null),
230-
contentBase ? express.static(contentBase) : undefined
229+
historyApiFallback(typeof options.historyApiFallback === "object" ? options.historyApiFallback : null)
231230
);
232231
}
233232
},
@@ -294,7 +293,7 @@ function Server(compiler, options) {
294293
if(contentBase !== false)
295294
defaultFeatures.push("contentBaseFiles");
296295
if(options.historyApiFallback)
297-
defaultFeatures.push("historyApiFallback", "middleware");
296+
defaultFeatures.push("historyApiFallback", "middleware", "contentBaseFiles");
298297
defaultFeatures.push("magicHtml");
299298
if(contentBase !== false)
300299
defaultFeatures.push("contentBaseIndex");

test/HistoryApiFallback.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var request = require("supertest");
33
var helper = require("./helper");
44
var config = require("./fixtures/historyapifallback-config/webpack.config");
55
var config2 = require("./fixtures/historyapifallback-2-config/webpack.config");
6+
var config3 = require("./fixtures/historyapifallback-3-config/webpack.config");
67

78
describe("HistoryApiFallback", function() {
89
var server;
@@ -113,7 +114,7 @@ describe("HistoryApiFallback", function() {
113114

114115
describe("in-memory files", function() {
115116
before(function(done) {
116-
server = helper.start(config2, {
117+
server = helper.start(config3, {
117118
contentBase: path.join(__dirname, "fixtures/historyapifallback-3-config"),
118119
historyApiFallback: true
119120
}, done);

0 commit comments

Comments
 (0)