File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ plugins: [
45
45
| ` modernize ` | ` boolean\|true ` | Attempt to upgrade ES5 syntax to equivalent modern syntax. |
46
46
| ` verbose ` | ` boolean\|false ` | Will log performance information and information about polyfills. |
47
47
| ` 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 |
48
49
49
50
50
51
## How does this work?
Original file line number Diff line number Diff line change @@ -68,7 +68,13 @@ const DEFAULT_OPTIONS = {
68
68
/**
69
69
* @default "polyfills.legacy.js"
70
70
*/
71
- polyfillsFilename : 'polyfills.legacy.js'
71
+ polyfillsFilename : 'polyfills.legacy.js' ,
72
+
73
+ /**
74
+ * RegExp patterns of assets to exclude
75
+ * @default []
76
+ */
77
+ exclude : [ ]
72
78
} ;
73
79
74
80
export default class OptimizePlugin {
@@ -130,7 +136,15 @@ export default class OptimizePlugin {
130
136
131
137
const processing = new WeakMap ( ) ;
132
138
const chunkAssets = Array . from ( compilation . additionalChunkAssets || [ ] ) ;
133
- const files = [ ...chunkFiles , ...chunkAssets ] ;
139
+ const files = [ ...chunkFiles , ...chunkAssets ]
140
+ . filter ( ( asset ) => {
141
+ for ( const pattern of this . options . exclude ) {
142
+ if ( pattern . test ( asset ) ) {
143
+ return false ;
144
+ }
145
+ }
146
+ return true ;
147
+ } ) ;
134
148
135
149
start ( 'Optimize Assets' ) ;
136
150
let transformed ;
You can’t perform that action at this time.
0 commit comments