Repository navigation
Closed
Labels
29-x-yESMbug 🪲has-repro-repoIssue can be reproduced by cloning a git repoplatform/macOSstatus/confirmedA maintainer reproduced the bug or agreed with the feature
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
29.0.0-beta.5
What operating system are you using?
macOS
Operating System Version
Sonoma 14.3
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
28
Expected Behavior
Packages should be found
Actual Behavior
Describe the bug
Reproduce
You can use this repo to reproduce (it just followed the steps below): https://github.com/johnlindquist/electron-29
npm create @quick-start/electron- Follow
esmguide - install
electron-logand use it in main/index.ts: https://github.com/johnlindquist/electron-29/blob/main/src/main/index.ts#L5 - install Electron 29
npm i electron@beta(29.0.0-beta.5 as of today)
npm run dev
Works fine
npm run build:mac
- Successfully builds
- open
./dist/mac-arm64/foo.app
Your run into a Cannot find package, "electron-log" error.
Uncaught Exception:
Error: Cannot find package '/Users/johnlindquist/dev/electron-29/dist/mac-arm64/electron-29.app/Contents/Resources/app.asar/node_modules/electron-log/package.json' imported from /Users/johnlindquist/dev/electron-29/dist/mac-arm64/electron-29.app/Contents/Resources/app.asar/out/main/index.mjs
Did you mean to import electron-log/src/index.js?
at legacyMainResolve (node:internal/modules/esm/resolve:189:26)
at packageResolve (node:internal/modules/esm/resolve:783:14)
at moduleResolve (node:internal/modules/esm/resolve:845:20)
at defaultResolve (node:internal/modules/esm/resolve:1050:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:228:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
at link (node:internal/modules/esm/module_job:84:36)
Fix
Downgrade to Electron 28, build works fine again.
Electron-Vite Version
2.0.0
Electron Version
29.0.0-beta.5
Vite Version
5.0.11
Validations
- Follow the Code of Conduct.
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Testcase Gist URL
No response
Additional Information
I originally reported this here: alex8088/electron-vite#401
But this they told me this is an Electron issue
Metadata
Metadata
Assignees
Labels
29-x-yESMbug 🪲has-repro-repoIssue can be reproduced by cloning a git repoplatform/macOSstatus/confirmedA maintainer reproduced the bug or agreed with the feature
Type
Projects
- StatusShow more project fields🛠️ Fixed for Next Release

Activity
codebytere commentedon Feb 5, 2024
hmm - i cloned your repo, installed deps, and ran
npm run build:macand I get:Are there any steps I might have missed?
johnlindquist commentedon Feb 5, 2024
@codebytere The error doesn't show until after you attempt to open the packaged app:
codebytere commentedon Feb 6, 2024
🤦🏻♀️ sorry, you're totally right. I see the issue and can repro it - this may be solved in #41209 but i can follow up and check.
johnlindquist commentedon Feb 6, 2024
@codebytere awesome, thanks. Let me know if there's anything else I can do to help.
johnlindquist commentedon Feb 6, 2024
@codebytere I just tried on v29.0.0-beta.6 which says it has the original-fs fix, but I'm getting the same error.
codebytere commentedon Feb 7, 2024
Yep - you're right, i'm seeing that too. I'll investigate more within the next ~week!
codebytere commentedon Feb 14, 2024
I think i've tracked this to nodejs/node#48325 via 9c94fd7 - looking a bit more
codebytere commentedon Feb 19, 2024
Closed by #41367
undergroundwires commentedon Mar 14, 2024
Thanks for the fix @codebytere, I can still reproduce this using latest electron (
29.1.4), did this bug creep in again somehow?kylekirkby commentedon Mar 14, 2024
Yh, we're seeing this too in
29.1.4undergroundwires commentedon Mar 17, 2024
I found out that I only get this when I import it using
/mainalias such as:Importing only from
electron-logdoes not yield this error:alex8088 commentedon Mar 18, 2024
@codebytere Electron ESM loader cannot correctly resolve subpath modules.
Bump Electron to latest and use native ESM