Skip to content

Commit

Permalink
chore: ignore option for serverAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonleex committed Mar 23, 2024
1 parent d1b9291 commit f688147
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rollup/plugins/server-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 ?? [])] }))
}`;
}

Expand Down
1 change: 1 addition & 0 deletions src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export interface PublicAssetDir {
export interface ServerAssetDir {
baseName: string;
dir: string;
ignore?: string[]
}

export interface DevServerOptions {
Expand Down

0 comments on commit f688147

Please sign in to comment.