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: [
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?
Original file line number Diff line number Diff 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
7480export default class OptimizePlugin {
@@ -130,7 +136,15 @@ export default class OptimizePlugin {
130136
131137 const processing = new WeakMap ( ) ;
132138 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+ } ) ;
134148
135149 start ( 'Optimize Assets' ) ;
136150 let transformed ;
You can’t perform that action at this time.
0 commit comments