@@ -6,9 +6,9 @@ const importTransformation = getDevlandFile('quasar/dist/transforms/import-trans
6
6
const runtimePath = require . resolve ( './runtime.auto-import.js' )
7
7
8
8
const 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' )
12
12
}
13
13
14
14
const dirRegex = new RegExp ( autoImportData . regex . directives , 'g' )
@@ -20,7 +20,10 @@ function transform (itemArray) {
20
20
}
21
21
22
22
function 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 ] )
24
27
let dir = content . match ( dirRegex )
25
28
26
29
if ( comp === null && dir === null ) {
@@ -35,11 +38,11 @@ function extract (content, ctx) {
35
38
comp = Array . from ( new Set ( comp ) )
36
39
37
40
// map comp names only if not pascal-case already
38
- if ( ctx . query !== '? pascal' ) {
41
+ if ( strategy !== 'pascal' ) {
39
42
comp = comp . map ( name => autoImportData . importName [ name ] )
40
43
}
41
44
42
- if ( ctx . query === '? combined' ) {
45
+ if ( strategy === 'combined' ) {
43
46
// could have been transformed QIcon and q-icon too,
44
47
// so avoid duplicates
45
48
comp = Array . from ( new Set ( comp ) )
0 commit comments