Skip to content

Commit

Permalink
feat(serverAssets): support ignore option (#2302)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonleex authored Apr 3, 2024
1 parent ebd27cc commit 2d6381d
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: (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 2d6381d

Please sign in to comment.