@@ -51,7 +51,7 @@ const defaultLoaders = {
51
51
* @param uxType
52
52
* @returns {* }
53
53
*/
54
- function makeLoaderString ( type , config , uxType ) {
54
+ function makeLoaderString ( type , config , isCard , uxType ) {
55
55
config = config || { }
56
56
let loaders
57
57
@@ -146,10 +146,11 @@ function makeLoaderString(type, config, uxType) {
146
146
}
147
147
]
148
148
149
- compileOptionsObject . enableExtractCss &&
149
+ if ( compileOptionsObject . enableExtractCss && ! isCard ) {
150
150
loaders . unshift ( {
151
151
name : defaultLoaders [ 'extract-css' ]
152
152
} )
153
+ }
153
154
154
155
let lang = config . lang
155
156
if ( lang && lang !== 'css' ) {
@@ -307,7 +308,7 @@ function processImportFrag($loader, imports, importNames, card, lite) {
307
308
} )
308
309
let reqStr = makeRequireString (
309
310
$loader ,
310
- makeLoaderString ( FRAG_TYPE . IMPORT ) ,
311
+ makeLoaderString ( FRAG_TYPE . IMPORT , null , card ) ,
311
312
`${ importSrc } ?uxType=${ ENTRY_TYPE . COMP } &name=${ importName } ${ cardParam } ${ liteParam } `
312
313
)
313
314
@@ -353,9 +354,13 @@ function processTemplateFrag($loader, templates, uxType, importNames, card, lite
353
354
importNames = importNames . map ( ( item ) => 'importNames[]=' + item )
354
355
retStr = makeRequireString (
355
356
$loader ,
356
- makeLoaderString ( FRAG_TYPE . TEMPLATE , {
357
- alone : ! ! fragAttrsSrc
358
- } ) ,
357
+ makeLoaderString (
358
+ FRAG_TYPE . TEMPLATE ,
359
+ {
360
+ alone : ! ! fragAttrsSrc
361
+ } ,
362
+ card
363
+ ) ,
359
364
`${ src } ?uxType=${ uxType } &${ importNames . join ( ',' ) } ${ cardParam } ${ liteParam } ${ pathParam } `
360
365
)
361
366
}
@@ -391,10 +396,14 @@ function processStyleFrag($loader, styles, uxType, card, lite) {
391
396
const pathParam = card ? `&uxPath=${ src } ` : ''
392
397
code = makeRequireString (
393
398
$loader ,
394
- makeLoaderString ( FRAG_TYPE . STYLE , {
395
- alone : ! ! fragAttrsSrc ,
396
- lang : fragAttrsLang
397
- } ) ,
399
+ makeLoaderString (
400
+ FRAG_TYPE . STYLE ,
401
+ {
402
+ alone : ! ! fragAttrsSrc ,
403
+ lang : fragAttrsLang
404
+ } ,
405
+ card
406
+ ) ,
398
407
`${ src } ?uxType=${ uxType } ${ cardParam } ${ liteParam } ${ pathParam } `
399
408
)
400
409
}
@@ -408,7 +417,7 @@ function processStyleFrag($loader, styles, uxType, card, lite) {
408
417
* @param uxType
409
418
* @returns {string }
410
419
*/
411
- function processScriptFrag ( $loader , scripts , uxType ) {
420
+ function processScriptFrag ( $loader , scripts , uxType , card ) {
412
421
let code = 'null'
413
422
if ( scripts . length ) {
414
423
// 有且仅有一个<script>节点
@@ -427,6 +436,7 @@ function processScriptFrag($loader, scripts, uxType) {
427
436
alone : ! ! fragAttrsSrc ,
428
437
path : $loader . resourcePath
429
438
} ,
439
+ card ,
430
440
uxType
431
441
) ,
432
442
`${ src } ?uxType=${ uxType } `
@@ -455,7 +465,7 @@ function processDataFrag($loader, datas, uxType) {
455
465
}
456
466
code = makeRequireString (
457
467
$loader ,
458
- makeLoaderString ( FRAG_TYPE . DATA , { } , uxType ) ,
468
+ makeLoaderString ( FRAG_TYPE . DATA , { } , true , uxType ) ,
459
469
`${ src } ?index=0&lite=1`
460
470
)
461
471
}
@@ -482,7 +492,7 @@ function processActionFrag($loader, datas, uxType) {
482
492
}
483
493
code = makeRequireString (
484
494
$loader ,
485
- makeLoaderString ( FRAG_TYPE . ACTIONS , { } , uxType ) ,
495
+ makeLoaderString ( FRAG_TYPE . ACTIONS , { } , true , uxType ) ,
486
496
`${ src } ?index=0&lite=1`
487
497
)
488
498
}
@@ -509,7 +519,7 @@ function processPropsFrag($loader, datas, uxType) {
509
519
}
510
520
code = makeRequireString (
511
521
$loader ,
512
- makeLoaderString ( FRAG_TYPE . PROPS , { } , uxType ) ,
522
+ makeLoaderString ( FRAG_TYPE . PROPS , { } , true , uxType ) ,
513
523
`${ src } ?index=0&lite=1`
514
524
)
515
525
}
0 commit comments