Skip to content

Commit

Permalink
fix(compile): module should be generated after dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Oct 11, 2023
1 parent b5e8926 commit d71bc50
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lib/compiler/ts-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,20 @@ export default async function TsLoader(content) {
};
}

await this.generateModule(loader.resourcePath, () => {
const result = ts.transpileModule(`${content}`, {
compilerOptions: {
target: ts.ScriptTarget.ESNext,
jsx: ts.JsxEmit.ReactJSX,
},
transformers: {
before: [transformer],
},
});
return result.outputText;
const result = ts.transpileModule(`${content}`, {
compilerOptions: {
target: ts.ScriptTarget.ESNext,
jsx: ts.JsxEmit.ReactJSX,
},
transformers: {
before: [transformer],
},
});

const assets = (await Promise.all(modules)).filter(
(m) => m?.metadata?.type === "asset"
);
await this.generateModule(loader.resourcePath, () => result.outputText);
const exports = await loader.importModule(this.resourcePath);
if (!(exports.default instanceof Function)) {
return;
Expand Down

0 comments on commit d71bc50

Please sign in to comment.