Skip to content

Commit

Permalink
fix(untyped): use custom jiti instance
Browse files Browse the repository at this point in the history
regression of #409
  • Loading branch information
pi0 committed Jul 3, 2024
1 parent 8e7d675 commit 00ded57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/builders/untyped/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
UntypedOutputs,
} from "../../types";
import consola from "consola";
import { createJiti } from "jiti";

export async function typesBuild(ctx: BuildContext): Promise<void> {
const entries = ctx.options.entries.filter(
Expand All @@ -25,6 +26,7 @@ export async function typesBuild(ctx: BuildContext): Promise<void> {
for (const entry of entries) {
const options = {
jiti: {
interopDefault: true,
transformOptions: {
babel: {
plugins: [untypedPlugin],
Expand All @@ -34,9 +36,11 @@ export async function typesBuild(ctx: BuildContext): Promise<void> {
};
await ctx.hooks.callHook("untyped:entry:options", ctx, entry, options);

const untypedJiti = createJiti(ctx.options.rootDir, options.jiti);

const distDir = entry.outDir!;
const srcConfig =
((await ctx.jiti.import(resolve(ctx.options.rootDir, entry.input), {
((await untypedJiti.import(resolve(ctx.options.rootDir, entry.input), {
try: true,
})) as InputObject) || ({} as InputObject);

Expand Down

0 comments on commit 00ded57

Please sign in to comment.