forked from epicweb-dev/epic-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (24 loc) · 637 Bytes
/
index.js
File metadata and controls
27 lines (24 loc) · 637 Bytes
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
import 'dotenv/config'
import * as fs from 'node:fs'
import sourceMapSupport from 'source-map-support'
sourceMapSupport.install({
retrieveSourceMap: function (source) {
// get source file without the `file://` prefix or `?t=...` suffix
const match = source.match(/^file:\/\/(.*)\?t=[.\d]+$/)
if (match) {
return {
url: source,
map: fs.readFileSync(`${match[1]}.map`, 'utf8'),
}
}
return null
},
})
if (process.env.MOCKS === 'true') {
await import('./tests/mocks/index.ts')
}
if (process.env.NODE_ENV === 'production') {
await import('./server-build/index.js')
} else {
await import('./server/index.ts')
}