fix: use dynamic import instead of require for browser compatibility
- Replace require() with await import() for ES module compatibility - Add async to setTimeout callback for dynamic import support
This commit is contained in:
@@ -146,8 +146,9 @@ async function initializeReader(): Promise<void> {
|
|||||||
// Render the initial chapter content
|
// Render the initial chapter content
|
||||||
await renderSpineItem();
|
await renderSpineItem();
|
||||||
// Initialize page calculation for dynamic page numbers
|
// Initialize page calculation for dynamic page numbers
|
||||||
setTimeout(() => {
|
setTimeout(async () => {
|
||||||
const { initializePageCalculation } = require("./core/reader-navigation");
|
const { initializePageCalculation } =
|
||||||
|
await import("./core/reader-navigation");
|
||||||
initializePageCalculation();
|
initializePageCalculation();
|
||||||
}, 100);
|
}, 100);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user