-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (27 loc) · 769 Bytes
/
index.js
File metadata and controls
31 lines (27 loc) · 769 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
28
29
30
31
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') {
let build = (await import('./build/server/static/js/app.js'))
build = await (build?.default ?? build)
const createApp = build?.createApp ?? build
await createApp()
} else {
await import('./server/dev-build.js')
}