diff --git a/lib/compiler/ts-loader.js b/lib/compiler/ts-loader.js index 32d51b6..148b6ad 100644 --- a/lib/compiler/ts-loader.js +++ b/lib/compiler/ts-loader.js @@ -45,6 +45,7 @@ export default async function TsLoader(content) { }; } + // TODO: 考虑改成从项目目录内的 tsconfig.json 读取配置 const tsResult = ts.transpileModule(`${content}`, { compilerOptions: { target: ts.ScriptTarget.ESNext, @@ -58,7 +59,12 @@ export default async function TsLoader(content) { const assets = (await Promise.all(modules)).filter( (m) => m?.metadata?.type === "asset" ); - await loader.generateModule(loader.resourcePath, () => tsResult.outputText); + await loader.generateModule(loader.resourcePath, () => + tsResult.outputText.replace( + "react/jsx-runtime", + "@lcui/react/lib/jsx-runtime.js" + ) + ); const { default: componentFunc } = await loader.importModule( loader.resourcePath );