Skip to content

Commit ce946ca

Browse files
authored
fix: Filter files with raw (#20)
1 parent 24f53db commit ce946ca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/core/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const unpluginFactory: UnpluginFactory<Options> = (options = {}) => {
2323
transformInclude(id) {
2424
const { file, isSfc, query } = parse_ID(id);
2525

26-
if (filter(file)) {
26+
if (query.raw == null && filter(file)) {
2727
if (isSfc && query.type !== 'template') {
2828
return (
2929
// vite-plugin-vue

src/core/parse_ID.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@ import { TRACE_ID } from './constants';
33

44
export interface VueQuery extends Record<string, any> {
55
type?: 'script' | 'template' | 'style' | 'custom';
6+
raw?: string;
67
[TRACE_ID]?: string;
78
}
89

910
export function parse_ID(id: string, root = '') {
1011
const [file, rawQuery] = id.split('?', 2);
1112
const ext = extname(file).slice(1);
13+
const query = Object.fromEntries(new URLSearchParams(rawQuery)) as VueQuery;
1214

1315
if (ext === 'vue') {
1416
return {
1517
file: file.replace(root, ''),
1618
isSfc: true,
17-
query: Object.fromEntries(new URLSearchParams(rawQuery)) as VueQuery,
19+
query,
1820
};
1921
}
2022

2123
return {
2224
file: file.replace(root, ''),
2325
isJsx: true,
2426
isTsx: ext.includes('ts'),
27+
query,
2528
};
2629
}

0 commit comments

Comments
 (0)