fix transpiler caching, jsx runtime
This commit is contained in:
parent
d320b2d74e
commit
6dde10c2ae
|
|
@ -75,14 +75,15 @@ const transpileCache: Record<string, string> = {}
|
|||
|
||||
// Transpile the frontend *.ts file at `path` to JavaScript.
|
||||
export async function transpile(path: string): Promise<string> {
|
||||
const code = await Bun.file(path).text()
|
||||
|
||||
const { mtime } = await stat(path)
|
||||
const key = `${path}?${mtime}`
|
||||
|
||||
let cached = transpileCache[key]
|
||||
if (!cached) {
|
||||
const code = await Bun.file(path).text()
|
||||
cached = transpiler.transformSync(code)
|
||||
cached = cached.replaceAll(/\bjsxDEV_?\w*\(/g, "jsx(")
|
||||
|
||||
transpileCache[key] = cached
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user