From 04c2b5cd1a16e34634ab1c79dacdd95a4ea19ba1 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 2 Jul 2024 14:12:05 +0200 Subject: [PATCH 1/2] chore: remove unused imports --- src/builders/rollup/build.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/builders/rollup/build.ts b/src/builders/rollup/build.ts index 2806bdd6..ef6353c9 100644 --- a/src/builders/rollup/build.ts +++ b/src/builders/rollup/build.ts @@ -1,8 +1,8 @@ -import type { OutputOptions, OutputChunk, PreRenderedChunk } from "rollup"; +import type { OutputOptions, OutputChunk } from "rollup"; import { rollup } from "rollup"; import dts from "rollup-plugin-dts"; -import { resolve, relative } from "pathe"; -import type { BuildContext, RollupOptions } from "../../types"; +import { resolve } from "pathe"; +import type { BuildContext } from "../../types"; import { removeShebangPlugin } from "./plugins/shebang"; import consola from "consola"; import { getRollupOptions } from "./config"; From 0cabd3c701fd7e6530f52235c034b84bd9bffb46 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 2 Jul 2024 14:14:27 +0200 Subject: [PATCH 2/2] fix: enable jiti `interopDefault` for config loader and internals (ref: #409) --- src/build.ts | 4 ++-- src/utils.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/build.ts b/src/build.ts index 869f56e9..31e2098b 100644 --- a/src/build.ts +++ b/src/build.ts @@ -28,7 +28,7 @@ export async function build( rootDir = resolve(process.cwd(), rootDir || "."); // Create jiti instance for loading initial config - const jiti = createJiti(rootDir); + const jiti = createJiti(rootDir, { interopDefault: true }); const _buildConfig: BuildConfig | BuildConfig[] = (await jiti.import("./build.config", { try: true })) || {}; @@ -156,7 +156,7 @@ async function _build( options.outDir = resolve(options.rootDir, options.outDir); // Create shared jiti instance for context - const jiti = createJiti(options.rootDir, options.stubOptions.jiti); + const jiti = createJiti(options.rootDir, { interopDefault: true }); // Build context const ctx: BuildContext = { diff --git a/src/utils.ts b/src/utils.ts index f025d0c8..4df62a5b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -72,7 +72,9 @@ export async function resolvePreset( if (preset === "auto") { preset = autoPreset; } else if (typeof preset === "string") { - preset = (await createJiti(rootDir).import(preset)) || {}; + preset = + (await createJiti(rootDir, { interopDefault: true }).import(preset)) || + {}; } if (typeof preset === "function") { preset = preset();