[Vuejs]-Multi page VueJS / Express asset issue on production

0๐Ÿ‘

โœ…

I managed to work it out, incase anyone has the same issue in future.

The connect-history-api-fallback package needed to provided with the htmlAcceptHeaders option to only rewrite the html location, and not the JS/CSS assets.

app.use(history({

    rewrites: [{
        from: /\/app/,
        to: '/app/index.html'
    }],

    htmlAcceptHeaders: ['text/html', 'application/xhtml+xml']

}));

app.use(express.static(path.join(__dirname, '../../client/dist')))

Leave a comment