Skip to content

Commit 1815649

Browse files
committed
perf(rollup-plugin-html): create matcher once
1 parent 1420d75 commit 1815649

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/rollup-plugin-html/src/input/extract/extractAssets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export interface ExtractAssetsParams {
2222
export function extractAssets(params: ExtractAssetsParams): InputAsset[] {
2323
const assetNodes = findAssets(params.document);
2424
const allAssets: InputAsset[] = [];
25+
const isExternal = picomatch(params.externalAssets || []);
2526

2627
for (const node of assetNodes) {
2728
const sourcePaths = getSourcePaths(node);
2829
for (const sourcePath of sourcePaths) {
29-
const isExternal = picomatch(params.externalAssets || []);
3030
if (isExternal(sourcePath)) continue;
3131

3232
const filePath = resolveAssetFilePath(

packages/rollup-plugin-html/src/output/injectedUpdatedAssetPaths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export function injectedUpdatedAssetPaths(args: InjectUpdatedAssetPathsArgs) {
4949
absolutePathPrefix,
5050
} = args;
5151
const assetNodes = findAssets(document);
52+
const isExternal = picomatch(externalAssets || []);
5253

5354
for (const node of assetNodes) {
5455
const sourcePaths = getSourcePaths(node);
5556
for (const sourcePath of sourcePaths) {
56-
const isExternal = picomatch(externalAssets || []);
5757
if (isExternal(sourcePath)) continue;
5858

5959
const htmlFilePath = input.filePath ? input.filePath : path.join(rootDir, input.name);

0 commit comments

Comments
 (0)