vite: add mock api, return 404s

This commit is contained in:
Alex Gleason 2024-01-12 17:25:15 -06:00
parent 60521f224d
commit d97602aa74
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -92,6 +92,19 @@ export default defineConfig(({ command }) => ({
filename: 'report.html', filename: 'report.html',
title: 'Soapbox Bundle', title: 'Soapbox Bundle',
}), }),
{
name: 'mock-api',
configureServer(server) {
server.middlewares.use((req, res, next) => {
if (/^\/api\//.test(req.url!)) {
res.statusCode = 404;
res.end('Not Found');
} else {
next();
}
});
},
},
], ],
resolve: { resolve: {
alias: [ alias: [