diff --git a/src/core/index.ts b/src/core/index.ts index 04969fc..379fecb 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -23,7 +23,7 @@ export const unpluginFactory: UnpluginFactory = (options = {}) => { transformInclude(id) { const { file, isSfc, query } = parse_ID(id); - if (filter(file)) { + if (query.raw == null && filter(file)) { if (isSfc && query.type !== 'template') { return ( // vite-plugin-vue diff --git a/src/core/parse_ID.ts b/src/core/parse_ID.ts index bbf2d64..fc5039c 100644 --- a/src/core/parse_ID.ts +++ b/src/core/parse_ID.ts @@ -3,18 +3,20 @@ import { TRACE_ID } from './constants'; export interface VueQuery extends Record { type?: 'script' | 'template' | 'style' | 'custom'; + raw?: string; [TRACE_ID]?: string; } export function parse_ID(id: string, root = '') { const [file, rawQuery] = id.split('?', 2); const ext = extname(file).slice(1); + const query = Object.fromEntries(new URLSearchParams(rawQuery)) as VueQuery; if (ext === 'vue') { return { file: file.replace(root, ''), isSfc: true, - query: Object.fromEntries(new URLSearchParams(rawQuery)) as VueQuery, + query, }; } @@ -22,5 +24,6 @@ export function parse_ID(id: string, root = '') { file: file.replace(root, ''), isJsx: true, isTsx: ext.includes('ts'), + query, }; }