@@ -6,9 +6,9 @@ const importTransformation = getDevlandFile('quasar/dist/transforms/import-trans
66const runtimePath = require . resolve ( './runtime.auto-import.js' )
77
88const compRegex = {
9- '? kebab' : new RegExp ( autoImportData . regex . kebabComponents || autoImportData . regex . components , 'g' ) ,
10- '? pascal' : new RegExp ( autoImportData . regex . pascalComponents || autoImportData . regex . components , 'g' ) ,
11- '? combined' : new RegExp ( autoImportData . regex . components , 'g' )
9+ 'kebab' : new RegExp ( autoImportData . regex . kebabComponents || autoImportData . regex . components , 'g' ) ,
10+ 'pascal' : new RegExp ( autoImportData . regex . pascalComponents || autoImportData . regex . components , 'g' ) ,
11+ 'combined' : new RegExp ( autoImportData . regex . components , 'g' )
1212}
1313
1414const dirRegex = new RegExp ( autoImportData . regex . directives , 'g' )
@@ -20,7 +20,10 @@ function transform (itemArray) {
2020}
2121
2222function extract ( content , ctx ) {
23- let comp = content . match ( compRegex [ ctx . query ] )
23+ // Use webpack v5 getOptions or fallback to ctx.query for webpack v4
24+ const { strategy } = ctx . getOptions ? ctx . getOptions ( ) : ctx . query
25+
26+ let comp = content . match ( compRegex [ strategy ] )
2427 let dir = content . match ( dirRegex )
2528
2629 if ( comp === null && dir === null ) {
@@ -35,11 +38,11 @@ function extract (content, ctx) {
3538 comp = Array . from ( new Set ( comp ) )
3639
3740 // map comp names only if not pascal-case already
38- if ( ctx . query !== '? pascal' ) {
41+ if ( strategy !== 'pascal' ) {
3942 comp = comp . map ( name => autoImportData . importName [ name ] )
4043 }
4144
42- if ( ctx . query === '? combined' ) {
45+ if ( strategy === 'combined' ) {
4346 // could have been transformed QIcon and q-icon too,
4447 // so avoid duplicates
4548 comp = Array . from ( new Set ( comp ) )
0 commit comments