-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
/
server.configs.js
61 lines (57 loc) · 1.41 KB
/
server.configs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import * as path from 'node:path';
import * as url from 'node:url';
import { rewriteRules } from './middleware.js';
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Production (CDN URLs, watch disabled)
export const prodConfig = {
ghostMode: false,
hostname: '127.0.0.1',
notify: false,
open: false,
port: 8080,
server: {
baseDir: './docs',
},
snippet: false,
ui: false,
};
// Development (local URLs, watch enabled)
export const devConfig = {
...prodConfig,
files: ['CHANGELOG.md', 'docs/**/*', 'dist/**/*'],
port: 3000,
rewriteRules,
reloadDebounce: 1000,
reloadOnRestart: true,
server: {
...prodConfig.server,
routes: {
'/changelog.md': path.resolve(__dirname, 'CHANGELOG.md'),
'/dist': path.resolve(__dirname, 'dist'),
'/node_modules': path.resolve(__dirname, 'node_modules'), // Required for automated Vue tests
},
},
snippet: true,
};
// Test (local URLs, watch disabled)
export const testConfig = {
...devConfig,
port: 4000,
server: {
...devConfig.server,
middleware: [
// Blank page required for test environment
{
route: '/_blank.html',
handle(req, res, next) {
res.setHeader('Content-Type', 'text/html');
res.end('<!DOCTYPE html><html><body></body></html>');
next();
},
},
],
},
snippet: false,
watch: false,
};