Repository navigation
Expand file tree
/
Copy pathgatsby-node.js
More file actions
76 lines (70 loc) · 1.89 KB
/
Copy pathgatsby-node.js
File metadata and controls
76 lines (70 loc) · 1.89 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const path = require('path')
const express = require('express')
const DBG_PROGRESS_ROUTE = '/projects/dynamic-belief-games/DBG_progress'
const DBG_PROGRESS_DIR = path.join(
__dirname,
'static',
'projects',
'dynamic-belief-games',
'DBG_progress'
)
const PD_COMPANION_ROUTE = '/projects/pd-research-companion'
const PD_COMPANION_DIR = path.join(__dirname, 'static', 'projects', 'pd-research-companion')
const MICCAI_PROJECT_ROUTE = '/projects/posterior-aware-pd-phenotyping-miccai'
const MICCAI_PROJECT_DIR = path.join(
__dirname,
'static',
'projects',
'posterior-aware-pd-phenotyping-miccai'
)
exports.onCreateDevServer = ({ app }) => {
app.use(
DBG_PROGRESS_ROUTE,
express.static(DBG_PROGRESS_DIR, {
extensions: ['html'],
index: ['index.html'],
})
)
app.use(
MICCAI_PROJECT_ROUTE,
express.static(MICCAI_PROJECT_DIR, {
extensions: ['html'],
index: ['index.html'],
})
)
app.use(
PD_COMPANION_ROUTE,
express.static(PD_COMPANION_DIR, {
extensions: ['html'],
index: ['index.html'],
})
)
}
// Suppress webpack cache warnings in development
exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
const config = getConfig()
// Disable webpack cache warnings
if (stage === 'develop' || stage === 'develop-html') {
// Override the default cache settings
config.cache = {
type: 'filesystem',
compression: false,
store: 'pack',
buildDependencies: {
config: [__filename],
},
// Increase the threshold for warnings
maxMemoryGenerations: Infinity,
memoryCacheUnaffected: true,
// Disable serialization warnings
profile: false,
}
// Suppress infrastructure logging warnings
config.infrastructureLogging = {
level: 'error',
debug: false,
}
// Replace the entire config
actions.replaceWebpackConfig(config)
}
}