diff --git a/src/rollup/plugins/server-assets.ts b/src/rollup/plugins/server-assets.ts index 753ad41893..f2cb5bd5d5 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: ["**/node_modules/**", "**/.git/**", ...(asset?.ignore ?? [])] })) }`; } diff --git a/src/types/nitro.ts b/src/types/nitro.ts index 6747d80f05..7904ad9afc 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 {