Skip to content

Commit 485a692

Browse files
fix: Loading the project from npx [Issue: 3]
1 parent dd5d20d commit 485a692

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/lib.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ export function start(
222222
liascriptPath + '/index.html',
223223
'utf8',
224224
function (err: any, data: string) {
225+
if (err || !data) {
226+
res.status(500).send('index.html not found or could not be read')
227+
return
228+
}
225229
res.send(
226230
data.replace(
227231
'</head>',
@@ -240,6 +244,10 @@ export function start(
240244
liascriptPath + '/index.html',
241245
'utf8',
242246
function (err: any, data: string) {
247+
if (err || !data) {
248+
res.status(500).send('index.html not found or could not be read')
249+
return
250+
}
243251
res.send(
244252
data.replace(
245253
'</head>',
@@ -257,6 +265,10 @@ export function start(
257265
liascriptPath + '/index.html',
258266
'utf8',
259267
function (err: any, data: string) {
268+
if (err || !data) {
269+
res.status(500).send('index.html not found or could not be read')
270+
return
271+
}
260272
res.send(
261273
data.replace(
262274
'</head>',
@@ -274,6 +286,10 @@ export function start(
274286
liascriptPath + '/index.html',
275287
'utf8',
276288
function (err: any, data: string) {
289+
if (err || !data) {
290+
res.status(500).send('index.html not found or could not be read')
291+
return
292+
}
277293
res.send(data.replace('</head>', `${gotoScript}</head>`))
278294
}
279295
)

0 commit comments

Comments
 (0)