Skip to content

Commit

Permalink
feat: pass resolved config to rollup:before hook (#1160)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Apr 18, 2023
1 parent 490f0ab commit 48a979e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function copyPublicAssets(nitro: Nitro) {

export async function build(nitro: Nitro) {
const rollupConfig = getRollupConfig(nitro);
await nitro.hooks.callHook("rollup:before", nitro);
await nitro.hooks.callHook("rollup:before", nitro, rollupConfig);
return nitro.options.dev
? _watch(nitro, rollupConfig)
: _build(nitro, rollupConfig);
Expand Down
2 changes: 1 addition & 1 deletion src/rollup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { appConfig } from "./plugins/app-config";

export type RollupConfig = InputOptions & { output: OutputOptions };

export const getRollupConfig = (nitro: Nitro) => {
export const getRollupConfig = (nitro: Nitro): RollupConfig => {
const extensions: string[] = [".ts", ".mjs", ".js", ".json", ".node"];

const nodePreset = nitro.options.node === false ? unenv.nodeless : unenv.node;
Expand Down
2 changes: 1 addition & 1 deletion src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface PrerenderGenerateRoute extends PrerenderRoute {

type HookResult = void | Promise<void>;
export interface NitroHooks {
"rollup:before": (nitro: Nitro) => HookResult;
"rollup:before": (nitro: Nitro, config: RollupConfig) => HookResult;
compiled: (nitro: Nitro) => HookResult;
"dev:reload": () => HookResult;
close: () => HookResult;
Expand Down

0 comments on commit 48a979e

Please sign in to comment.