fix: avoid vite optional stream import resolution

This commit is contained in:
hibna
2026-02-13 05:16:02 +03:00
parent ab1135ef74
commit 69d7706967
6 changed files with 32 additions and 10 deletions
+4 -2
View File
@@ -50,9 +50,11 @@ export const loadHls = async (): Promise<HlsConstructor> => {
try {
logger.log('[HLS Loader] Attempting to load from npm package...')
// Try loading from npm package first
const hlsModule = await import('hls.js')
const hlsModuleName = 'hls.js'
const hlsModule = await import(/* @vite-ignore */ hlsModuleName)
const moduleWithDefault = hlsModule as { default?: HlsConstructor }
logger.log('[HLS Loader] Successfully loaded from npm package')
return hlsModule.default
return moduleWithDefault.default ?? (hlsModule as unknown as HlsConstructor)
} catch (npmError) {
logger.warn('[HLS Loader] Failed to load from npm, trying CDN...', npmError)
try {