@@ -27,6 +27,7 @@ import {
27
27
} from './plugin' ;
28
28
import { createRollupError , normalizeRollupOutputOptions } from './rollup' ;
29
29
import { configurePreviewServer , getViteIndexTags } from './dev' ;
30
+ import { isVirtualId } from './vite-utils' ;
30
31
31
32
const DEDUPE = [
32
33
QWIK_CORE_ID ,
@@ -383,14 +384,16 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
383
384
} ,
384
385
385
386
resolveId ( id , importer , resolveIdOpts ) {
386
- if ( id . startsWith ( '\0' ) || ! fileFilter ( id , 'resolveId' ) ) {
387
+ const shouldResolveFile = fileFilter ( id , 'resolveId' ) ;
388
+ if ( isVirtualId ( id ) || ! shouldResolveFile ) {
387
389
return null ;
388
390
}
389
391
return qwikPlugin . resolveId ( this , id , importer , resolveIdOpts ) ;
390
392
} ,
391
393
392
394
load ( id , loadOpts ) {
393
- if ( id . startsWith ( '\0' ) || ! fileFilter ( id , 'load' ) ) {
395
+ const shouldLoadFile = fileFilter ( id , 'load' ) ;
396
+ if ( isVirtualId ( id ) || ! shouldLoadFile ) {
394
397
return null ;
395
398
}
396
399
@@ -405,7 +408,9 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
405
408
} ,
406
409
407
410
transform ( code , id , transformOpts ) {
408
- if ( id . startsWith ( '\0' ) || ! fileFilter ( id , 'transform' ) || id . includes ( '?raw' ) ) {
411
+ const shouldTransformFile = fileFilter ( id , 'transform' ) ;
412
+ const isStringImportId = id . includes ( '?raw' ) ;
413
+ if ( isVirtualId ( id ) || ! shouldTransformFile || isStringImportId ) {
409
414
return null ;
410
415
}
411
416
if (
@@ -801,7 +806,7 @@ interface QwikVitePluginCommonOptions {
801
806
* Predicate function to filter out files from the optimizer. hook for resolveId, load, and
802
807
* transform
803
808
*/
804
- fileFilter ?: ( id : string , hook : string ) => boolean ;
809
+ fileFilter ?: ( id : string , hook : keyof VitePlugin ) => boolean ;
805
810
/**
806
811
* Run eslint on the source files for the ssr build or dev server. This can slow down startup on
807
812
* large projects. Defaults to `true`
0 commit comments