Skip to content

Commit c9f5a6e

Browse files
author
Guillaume Chau
committed
fix: index.html filter not working, closes #12
1 parent f9480ec commit c9f5a6e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/app.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,16 @@ module.exports = (app, options) => {
7777
app.use(compression({ threshold: 0 }))
7878
app.use(favicon(config.favicon))
7979
if (config.api.hasPlugin('pwa')) {
80-
app.get('/service-worker.js', serve(config.serviceWorkerPath))
80+
app.use('/service-worker.js', serve(config.serviceWorkerPath, true))
8181
}
82-
app.use(/^((?!index\.).)*$/i, serve(config.distPath, true))
82+
const serveStaticFiles = serve(config.distPath, true)
83+
app.use((req, res, next) => {
84+
if (/index\.html/g.test(req.path)) {
85+
next()
86+
} else {
87+
serveStaticFiles(req, res, next)
88+
}
89+
})
8390

8491
// Render the Vue app using the bundle renderer
8592
const renderApp = (req, res) => {

0 commit comments

Comments
 (0)