diff --git a/src/rollup/plugins/server-assets.ts b/src/rollup/plugins/server-assets.ts index 753ad41893..57b8e776ad 100644 --- a/src/rollup/plugins/server-assets.ts +++ b/src/rollup/plugins/server-assets.ts @@ -46,6 +46,7 @@ export function serverAssets(nitro: Nitro): Plugin { const files = await globby("**/*.*", { cwd: asset.dir, absolute: false, + ignore: asset.ignore, }); for (const _id of files) { const fsPath = resolve(asset.dir, _id); @@ -78,7 +79,7 @@ const serverAssets = ${JSON.stringify(nitro.options.serverAssets)} export const assets = createStorage() for (const asset of serverAssets) { - assets.mount(asset.baseName, fsDriver({ base: asset.dir })) + assets.mount(asset.baseName, fsDriver({ base: asset.dir, ignore: (asset?.ignore || []) })) }`; } diff --git a/src/types/nitro.ts b/src/types/nitro.ts index 441719c94e..d2d693d45f 100644 --- a/src/types/nitro.ts +++ b/src/types/nitro.ts @@ -159,6 +159,7 @@ export interface PublicAssetDir { export interface ServerAssetDir { baseName: string; dir: string; + ignore?: string[]; } export interface DevServerOptions {