Skip to content

Commit 7e74df0

Browse files
Configure a dummy Vite plugin middleware
1 parent df9a054 commit 7e74df0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

svelte.config.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import adapter from '@sveltejs/adapter-node';
22
import preprocess from 'svelte-preprocess';
33

4+
const myPlugin = {
5+
name: 'log-request-middleware',
6+
configureServer(server) {
7+
server.middlewares.use((req, res, next) => {
8+
console.log(`Got request ${req.url}`);
9+
next();
10+
});
11+
}
12+
};
13+
414
/** @type {import('@sveltejs/kit').Config} */
515
const config = {
616
// Consult https://github.com/sveltejs/svelte-preprocess
@@ -9,7 +19,10 @@ const config = {
919

1020
kit: {
1121
adapter: adapter(),
12-
trailingSlash: 'always'
22+
trailingSlash: 'always',
23+
vite: {
24+
plugins: [myPlugin]
25+
}
1326
}
1427
};
1528

0 commit comments

Comments
 (0)