Skip to content

Commit 6bf8dde

Browse files
fix: fetching of relative resources like json
1 parent 86eba8c commit 6bf8dde

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,17 @@ export function start(
285285
app.get(
286286
'/liascript/*',
287287
function (req: express.Request, res: express.Response) {
288-
res.sendFile(req.params[0], { root: liascriptPath })
288+
res.sendFile(req.params[0], { root: liascriptPath }, (err) => {
289+
if (err) {
290+
// Extract the file path by removing the '/liascript/' prefix
291+
const projectPath = req.params[0]
292+
console.log(
293+
`File not found in liascriptPath, trying project.path: ${projectPath}`,
294+
project.path
295+
)
296+
res.sendFile(projectPath, { root: project.path })
297+
}
298+
})
289299
}
290300
)
291301
// ignore this one

0 commit comments

Comments
 (0)