Frontmatter
| id | 8859 |
| title | Enforce ESM Worker Instantiation Globally |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Jan 22, 2026, 12:48 AM |
| updatedAt | Jan 22, 2026, 12:54 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8859 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 22, 2026, 12:54 AM |
Enforce ESM Worker Instantiation Globally
tobiu assigned to @tobiu on Jan 22, 2026, 12:54 AM

tobiu
Jan 22, 2026, 12:54 AM
Input from Gemini 3 Pro:
✦ I have refactored
src/worker/Manager.mjs,src/main/addon/ServiceWorker.mjs, andsrc/remotes/Api.mjsto enforce ESM worker instantiation across all environments.Changes:
- Renamed
hasJsModulestouseMjsFilesto correctly reflect its purpose (file extension/path selection vs. module capability).- Updated
src/worker/Manager.mjsto always use{type: 'module'}when creating workers.- Updated
src/main/addon/ServiceWorker.mjsto always use{type: 'module'}when registering the service worker.- Updated
src/remotes/Api.mjsto use the renamed variable for consistency in path resolution.This ensures that
dist/developmentanddist/productionbuilds, which are now ESM, are loaded correctly.
tobiu closed this issue on Jan 22, 2026, 12:54 AM
The
hasJsModulescheck insrc/worker/Manager.mjsandsrc/main/addon/ServiceWorker.mjsincorrectly assumes thatdist/developmentanddist/productiondo not support ES modules. This causes blank pages as the new webpack builds output ESM bundles.Changes:
src/worker/Manager.mjsto always instantiate workers with{type: 'module'}.hasJsModuleslogic to primarily control file extensions (.mjsvs.js) and pathing, rather than module capability.src/main/addon/ServiceWorker.mjssimilarly.src/remotes/Api.mjsto ensure path resolution logic remains correct under the new environment assumptions.