Skip to content

Commit d6c1e46

Browse files
committed
feat: 替换 react/jsx-runtime
1 parent 0dafd1d commit d6c1e46

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/compiler/ts-loader.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default async function TsLoader(content) {
4545
};
4646
}
4747

48+
// TODO: 考虑改成从项目目录内的 tsconfig.json 读取配置
4849
const tsResult = ts.transpileModule(`${content}`, {
4950
compilerOptions: {
5051
target: ts.ScriptTarget.ESNext,
@@ -58,7 +59,12 @@ export default async function TsLoader(content) {
5859
const assets = (await Promise.all(modules)).filter(
5960
(m) => m?.metadata?.type === "asset"
6061
);
61-
await loader.generateModule(loader.resourcePath, () => tsResult.outputText);
62+
await loader.generateModule(loader.resourcePath, () =>
63+
tsResult.outputText.replace(
64+
"react/jsx-runtime",
65+
"@lcui/react/lib/jsx-runtime.js"
66+
)
67+
);
6268
const { default: componentFunc } = await loader.importModule(
6369
loader.resourcePath
6470
);

0 commit comments

Comments
 (0)