Skip to content

Commit 5ebe828

Browse files
committed
fix: assume resources without extension as js
fixes issue with vite entry
1 parent 3d55f4d commit 5ebe828

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { Resource } from './renderer'
22

3+
const IS_JS_RE = /\.[cm]?js(\?[^.]+)?$/
4+
const HAS_EXT_RE = /[^./]+\.[^./]+$/
5+
const IS_CSS_RE = /\.css(\?[^.]+)?$/
6+
37
export function isJS (file: string) {
4-
return /\.[cm]?js(\?[^.]+)?$/.test(file)
8+
return IS_JS_RE.test(file) || !HAS_EXT_RE.test(file)
59
}
610

711
export function isCSS (file: string) {
8-
return /\.css(\?[^.]+)?$/.test(file)
12+
return IS_CSS_RE.test(file)
913
}
1014

1115
export function normalizeFile (file: string): Resource {

0 commit comments

Comments
 (0)