Skip to content

Commit 5003976

Browse files
authored
Handle empty query string (#191)
1 parent 3da707e commit 5003976

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/cold-fireants-fry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vite-plugin-solid': patch
3+
---
4+
5+
handle empty query string

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,13 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
302302
typeof extension === 'string' ? extension : extension[0],
303303
);
304304

305-
id = id.replace(/\?.+$/, '');
305+
if (!filter(id)) {
306+
return null
307+
}
308+
309+
id = id.replace(/\?.*$/, '');
306310

307-
if (!filter(id) || !(/\.[mc]?[tj]sx$/i.test(id) || allExtensions.includes(currentFileExtension))) {
311+
if (!(/\.[mc]?[tj]sx$/i.test(id) || allExtensions.includes(currentFileExtension))) {
308312
return null;
309313
}
310314

0 commit comments

Comments
 (0)