This commit is contained in:
1 parent
b234c8dcae
commit
001cf146ee
10 files changed
+189
-217
No files matched your search
@@ -0,0 +1,20 @@
|
||||
// Copy the original ES5 hls.min.js source directly to dist/hlds.js.
|
||||
// This avoids Vite/esbuild adding arrow functions (which Chrome flags as "ES module content"
|
||||
// in extension URLs, preventing window.Hls from registering).
|
||||
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname, resolve } from 'path';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const src = resolve(__dirname, '../src/inject/hls.min.js');
|
||||
const dst = resolve(__dirname, '../dist/hlds.js');
|
||||
let data = readFileSync(src, 'utf-8');
|
||||
|
||||
// Remove sourceMappingURL line (avoids Chrome trying to fetch it from an invalid chrome-extension:// URL)
|
||||
data = data.replace(/[\r\n]+\/\/# sourceMappingURL=[^\s]*[\r\n]*/, '');
|
||||
|
||||
writeFileSync(dst, data);
|
||||
console.log(`[copy-hlds] Copied hls.min.js -> dist/hlds.js (${data.length} bytes, pure ES5 source)`);
|
||||
Reference in new issue
Block a user