File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -594,6 +594,7 @@ class Option {
594594 * @return {boolean }
595595 */
596596 isStyle ( resource ) {
597+ if ( resource == null ) return false ;
597598 const [ file ] = resource . split ( '?' , 1 ) ;
598599 return this . options . css . enabled && this . options . css . test . test ( file ) ;
599600 }
@@ -603,6 +604,7 @@ class Option {
603604 * @return {boolean }
604605 */
605606 isScript ( resource ) {
607+ if ( resource == null ) return false ;
606608 const [ file ] = resource . split ( '?' , 1 ) ;
607609 return this . options . js . enabled && this . options . js . test . test ( file ) ;
608610 }
Original file line number Diff line number Diff line change @@ -1481,6 +1481,18 @@ describe('plugin options unit tests', () => {
14811481 return expect ( received ) . toEqual ( true ) ;
14821482 } ) ;
14831483
1484+ test ( 'isScript null resource' , ( ) => {
1485+ option . options = {
1486+ js : {
1487+ enabled : true ,
1488+ test : option . js . test ,
1489+ } ,
1490+ } ;
1491+
1492+ const received = option . isScript ( null ) ;
1493+ return expect ( received ) . toEqual ( false ) ;
1494+ } ) ;
1495+
14841496 test ( 'getEntryPath' , ( ) => {
14851497 option . dynamicEntry = 'src/views/' ;
14861498 option . options . entry = option . dynamicEntry ;
You can’t perform that action at this time.
0 commit comments