Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/build/rollup/dev.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Nitro, RollupConfig } from "nitro/types";
import type { RollupWatcher } from "rollup";
import type { RollupOptions, RollupWatcher } from "rollup";
import { watch as chokidarWatch } from "chokidar";
import { defu } from "defu";
import { basename, join } from "pathe";
Expand Down Expand Up @@ -68,7 +68,7 @@ export async function watchDev(nitro: Nitro, rollupConfig: RollupConfig) {

function startRollupWatcher(nitro: Nitro, rollupConfig: RollupConfig) {
const watcher = rollup.watch(
defu(rollupConfig, {
defu(rollupConfig as RollupOptions, {
watch: {
chokidar: nitro.options.watchOptions,
},
Expand Down
4 changes: 2 additions & 2 deletions src/build/rollup/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { generateFSTree } from "../../utils/fs-tree.ts";
import { writeTypes } from "../types.ts";
import { writeBuildInfo } from "../info.ts";
import { formatRollupError } from "./error.ts";
import type { RollupOutput } from "rollup";
import type { RollupOptions, RollupOutput } from "rollup";

export async function buildProduction(nitro: Nitro, rollupConfig: RollupConfig) {
const rollup = await import("rollup");
Expand All @@ -20,7 +20,7 @@ export async function buildProduction(nitro: Nitro, rollupConfig: RollupConfig)
nitro.logger.info(
`Building server (builder: \`rollup\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`
);
const build = await rollup.rollup(rollupConfig).catch((error) => {
const build = await rollup.rollup(rollupConfig as RollupOptions).catch((error) => {
nitro.logger.error(formatRollupError(error));
throw error;
});
Expand Down
7 changes: 6 additions & 1 deletion src/types/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ import type {
TransformOptions as RolldownTransformOptions,
} from "rolldown";

export type RollupConfig = RollupInputOptions & {
export type RollupConfig = Omit<RollupInputOptions, "plugins"> & {
output?: RollupOutputOptions;
// Vite 8 / `@vitejs/plugin-vue` etc. return Rolldown-typed plugins now that
// Vite's `Plugin` extends `Rolldown.Plugin` instead of Rollup's own type.
// `rollupConfig` is also reused for the `rolldown` builder (see
// `build/vite/bundler.ts`), so accept either shape here.
plugins?: RollupInputOptions["plugins"] | RolldownInputOptions["plugins"];
};

export type RolldownConfig = RolldownInputOptions & {
Expand Down
Loading