@@ -32,8 +32,25 @@ class ImportParserPlugin {
3232
3333 const importOptions = parser . getCommentOptions ( expr . range ) ;
3434 if ( importOptions ) {
35+ if ( typeof importOptions . webpackIgnore !== "undefined" ) {
36+ if ( typeof importOptions . webpackIgnore !== "boolean" ) {
37+ parser . state . module . warnings . push (
38+ new UnsupportedFeatureWarning (
39+ parser . state . module ,
40+ `\`webpackIgnore\` expected a boolean, but received: ${
41+ importOptions . webpackIgnore
42+ } .`
43+ )
44+ ) ;
45+ } else {
46+ // Do not instrument `import()` is `webpackIgnore` is `true`
47+ if ( importOptions . webpackIgnore ) {
48+ return false ;
49+ }
50+ }
51+ }
3552 if ( typeof importOptions . webpackChunkName !== "undefined" ) {
36- if ( typeof importOptions . webpackChunkName !== "string" )
53+ if ( typeof importOptions . webpackChunkName !== "string" ) {
3754 parser . state . module . warnings . push (
3855 new UnsupportedFeatureWarning (
3956 parser . state . module ,
@@ -42,10 +59,12 @@ class ImportParserPlugin {
4259 } .`
4360 )
4461 ) ;
45- else chunkName = importOptions . webpackChunkName ;
62+ } else {
63+ chunkName = importOptions . webpackChunkName ;
64+ }
4665 }
4766 if ( typeof importOptions . webpackMode !== "undefined" ) {
48- if ( typeof importOptions . webpackMode !== "string" )
67+ if ( typeof importOptions . webpackMode !== "string" ) {
4968 parser . state . module . warnings . push (
5069 new UnsupportedFeatureWarning (
5170 parser . state . module ,
@@ -54,7 +73,9 @@ class ImportParserPlugin {
5473 } .`
5574 )
5675 ) ;
57- else mode = importOptions . webpackMode ;
76+ } else {
77+ mode = importOptions . webpackMode ;
78+ }
5879 }
5980 if ( typeof importOptions . webpackInclude !== "undefined" ) {
6081 if (
0 commit comments