Skip to content

Commit a0f160f

Browse files
authored
Merge branch 'main' into fix/worker-pool
2 parents 0744e51 + aefb895 commit a0f160f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ plugins: [
4545
| `modernize` | `boolean\|true` | Attempt to upgrade ES5 syntax to equivalent modern syntax. |
4646
| `verbose` | `boolean\|false` | Will log performance information and information about polyfills. |
4747
| `polyfillsFilename` | `string\|polyfills.legacy.js` | The name for the chunk containing polyfills for the legacy bundle. |
48+
| `exclude` | `RegExp[]\|[]` | Asset patterns that should be excluded |
4849

4950

5051
## How does this work?

src/index.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ const DEFAULT_OPTIONS = {
6868
/**
6969
* @default "polyfills.legacy.js"
7070
*/
71-
polyfillsFilename: 'polyfills.legacy.js'
71+
polyfillsFilename: 'polyfills.legacy.js',
72+
73+
/**
74+
* RegExp patterns of assets to exclude
75+
* @default []
76+
*/
77+
exclude: []
7278
};
7379

7480
export default class OptimizePlugin {
@@ -125,7 +131,15 @@ export default class OptimizePlugin {
125131

126132
const processing = new WeakMap();
127133
const chunkAssets = Array.from(compilation.additionalChunkAssets || []);
128-
const files = [...chunkFiles, ...chunkAssets];
134+
const files = [...chunkFiles, ...chunkAssets]
135+
.filter((asset) => {
136+
for (const pattern of this.options.exclude) {
137+
if (pattern.test(asset)) {
138+
return false;
139+
}
140+
}
141+
return true;
142+
});
129143

130144
start('Optimize Assets');
131145
let transformed;

0 commit comments

Comments
 (0)