Skip to content

Commit

Permalink
docs: improve output.filename function type (#3764)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Oct 19, 2024
1 parent f4f9d52 commit 43bf456
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
12 changes: 12 additions & 0 deletions e2e/cases/filename-function/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,16 @@ test('should allow to custom filename by function', async () => {
filename.includes('dist/static/js/async/some-path/foo.js'),
),
).toBeTruthy();

// CSS
expect(
filenames.some((filename) =>
filename.includes('dist/static/css/my-index.css'),
),
).toBeTruthy();
expect(
filenames.some((filename) =>
filename.includes('dist/static/css/async/some-path/foo.css'),
),
).toBeTruthy();
});
12 changes: 10 additions & 2 deletions website/docs/en/config/output/filename.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ type FilenameConfig = {
html?: string;
js?:
| string
| ((pathData: Rspack.PathData, assetInfo: Rspack.JsAssetInfo) => string);
css?: string;
| ((
pathData: Rspack.PathData,
assetInfo: Rspack.JsAssetInfo | undefined,
) => string);
css?:
| string
| ((
pathData: Rspack.PathData,
assetInfo: Rspack.JsAssetInfo | undefined,
) => string);
svg?: string;
font?: string;
image?: string;
Expand Down
10 changes: 8 additions & 2 deletions website/docs/zh/config/output/filename.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ type FilenameConfig = {
html?: string;
js?:
| string
| ((pathData: Rspack.PathData, assetInfo: Rspack.JsAssetInfo) => string);
| ((
pathData: Rspack.PathData,
assetInfo: Rspack.JsAssetInfo | undefined,
) => string);
css?:
| string
| ((pathData: Rspack.PathData, assetInfo: Rspack.JsAssetInfo) => string);
| ((
pathData: Rspack.PathData,
assetInfo: Rspack.JsAssetInfo | undefined,
) => string);
svg?: string;
font?: string;
image?: string;
Expand Down

0 comments on commit 43bf456

Please sign in to comment.