LearnNewsExamplesServices
Frontmatter
id7783
titleDynamically import fs/promises in Store.mjs for Node.js compatibility
stateClosed
labels
enhancementai
assigneestobiu
createdAtNov 17, 2025, 7:56 PM
updatedAtNov 17, 2025, 7:57 PM
githubUrlhttps://github.com/neomjs/neo/issues/7783
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 17, 2025, 7:57 PM

Dynamically import fs/promises in Store.mjs for Node.js compatibility

Closed v11.5.0 enhancementai
tobiu
tobiu commented on Nov 17, 2025, 7:56 PM

The src/data/Store.mjs currently attempts to use fs.readFile for non-browser environments (like Node.js) within its load method. However, the fs/promises module is conditionally imported using globalThis.process?.release. To prevent issues in browser environments where fs/promises is not available, the import needs to be dynamic.

This change will ensure that Store.mjs can be used seamlessly in web workers (browser environment) and Node.js, by only attempting to load the fs/promises module when it's actually needed and available.

Proposed Change: Modify the load method in src/data/Store.mjs to use a dynamic import('fs/promises') when globalThis.process?.release is true.

tobiu added the enhancement label on Nov 17, 2025, 7:56 PM
tobiu added the ai label on Nov 17, 2025, 7:56 PM
tobiu assigned to @tobiu on Nov 17, 2025, 7:57 PM
tobiu referenced in commit 0f0ed92 - "Dynamically import fs/promises in Store.mjs for Node.js compatibility #7783" on Nov 17, 2025, 7:57 PM
tobiu closed this issue on Nov 17, 2025, 7:57 PM