Fix ESM conversion in search and logging tabs#2434
Fix ESM conversion in search and logging tabs#2434sensei-hacker merged 3 commits intoiNavFlight:masterfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
| import { GUI, TABS } from './../js/gui.js'; | ||
| import i18n from './../js/localization.js'; |
There was a problem hiding this comment.
Suggestion: Normalize ESM import paths
| import { GUI, TABS } from './../js/gui.js'; | |
| import i18n from './../js/localization.js'; | |
| import { GUI, TABS } from './../js/gui'; | |
| import i18n from './../js/localization'; |
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
The previous commit added error handling to the appendFile IPC handler but forgot to add the 'async' keyword to the arrow function. This caused the build to fail with "await can only be used inside an async function" error.
User description
Summary
require()statements to ESM imports in search tabstoreimport in logging tabappendFileIPC handler for logging tab file operationsPR Type
Bug fix, Enhancement
Description
Convert search tab from CommonJS to ESM imports
Add missing store import to logging tab
Implement appendFile IPC handler for file operations
Replace synchronous fs.writeFileSync with async appendFile API
Diagram Walkthrough
File Walkthrough
configurator_main.js
Convert search tab to ESM dynamic importjs/configurator_main.js
require()to dynamic ESMimport()main.js
Add appendFile IPC handler for loggingjs/main/main.js
appendFileto fs/promises importsappendFileIPC handler for async file append operationswriteFilehandler
preload.js
Expose appendFile API to rendererjs/main/preload.js
appendFilemethod to renderer process via electronAPIappendFileIPC handlersearch.js
Convert search tab to ESM modulestabs/search.js
require()statements to ESMimportstatementspath.join(__dirname, ...)with dynamic import of search.htmllogging.js
Fix imports and async file operationstabs/logging.js
storeimport from localization modulefs.writeFileSync()with asyncwindow.electronAPI.appendFile()