Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove electron-vite for stock Electron (ESM) #63

Closed
alexwkleung opened this issue Oct 4, 2023 · 7 comments · Fixed by #85
Closed

Remove electron-vite for stock Electron (ESM) #63

alexwkleung opened this issue Oct 4, 2023 · 7 comments · Fixed by #85
Assignees
Labels
dev Development related future release / plans Plans or improvements for a future release

Comments

@alexwkleung
Copy link
Owner

alexwkleung commented Oct 4, 2023

Starting from Electron 28, there will be support for ESM.

This means I won't need the dependency of electron-vite for ESM. If that's the case here, I want to remove electron-vite and use stock Electron.

This is the better choice long-term and has proper compatibility with newer Electron releases. If time permits, I will begin removing electron-vite at the end of the core cleanup and setting it up for Electron 28+.

@alexwkleung alexwkleung added future release / plans Plans or improvements for a future release dev Development related labels Oct 4, 2023
@alexwkleung alexwkleung self-assigned this Oct 4, 2023
@alexwkleung
Copy link
Owner Author

Some recent commits to prepare: 6f8d2e9, 3a72b1f, dfa5996

@alexwkleung
Copy link
Owner Author

alexwkleung commented Dec 5, 2023

Planning on updating to Electron v28 for ESM and removing electron-vite in v0.2.0-dev-6.0.

Not 100% sure if the migration process will be smooth but I'll give it a try.

@alexwkleung
Copy link
Owner Author

In Electron-ESM-Vite sample project, I'm testing to see if it's worth setting up Vite with Electron and ESM "natively" out of the box.

I've been running into some issues related to HMR/reloading and preload scripts, so that is one of the downsides for now. I have not tried packaging the application yet so I will test it as well.

For small projects, it might be sufficient. I'm mostly concerned about scalability and other edge cases that might cause things to break.

@alexwkleung
Copy link
Owner Author

alexwkleung commented Dec 16, 2023

In Electron-ESM-Vite sample project, I'm testing to see if it's worth setting up Vite with Electron and ESM "natively" out of the box.

I've been running into some issues related to HMR/reloading and preload scripts, so that is one of the downsides for now. I have not tried packaging the application yet so I will test it as well.

For small projects, it might be sufficient. I'm mostly concerned about scalability and other edge cases that might cause things to break.

I added HMR support to it and it seems to work fine for now. I am planning on trying this in v0.2.0-dev-6.0.

@alexwkleung
Copy link
Owner Author

Within the next few days, I will be working on migrating from electron-vite to Electron-ESM-Vite.

Since there are a lot of files in the source code, it will be a good test to see if it works.

@alexwkleung
Copy link
Owner Author

alexwkleung commented Dec 18, 2023

Currently in the process of migrating and for the most part it works fine.

However, the issue I'm facing is compiling the universal build of the app. For compiling macOS x64 and arm64 separately, it works without issues.

The error I'm getting is related to the glob pattern being too big. I don't know what would cause this so I'll need to dig further into the issue.

  • electron-builder  version=23.6.0 os=22.6.0
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=darwin arch=x64 electron=28.0.0 appOutDir=dist/mac-universal--x64
  • packaging       platform=darwin arch=arm64 electron=28.0.0 appOutDir=dist/mac-universal--arm64
  • packaging       platform=darwin arch=universal electron=28.0.0 appOutDir=dist/mac-universal
  ⨯ pattern is too long  failedTask=build stackTrace=TypeError: pattern is too long
    at assertValidPattern (/Users/alex/Desktop/Git/Iris/node_modules/minimatch/minimatch.js:279:11)
    at minimatch (/Users/alex/Desktop/Git/Iris/node_modules/minimatch/minimatch.js:116:3)
    at handleFile (/Users/alex/Desktop/Git/Iris/node_modules/asar/lib/asar.js:123:26)
    at next (/Users/alex/Desktop/Git/Iris/node_modules/asar/lib/asar.js:148:11)
    at next (/Users/alex/Desktop/Git/Iris/node_modules/asar/lib/asar.js:149:12)
    at Object.exports.mergeASARs (/Users/alex/Desktop/Git/Iris/node_modules/@electron/universal/src/asar-utils.ts:198:5)
    at exports.makeUniversalApp (/Users/alex/Desktop/Git/Iris/node_modules/@electron/universal/src/index.ts:205:7)
    at MacPackager.doPack (/Users/alex/Desktop/Git/Iris/node_modules/app-builder-lib/src/macPackager.ts:125:9)
    at MacPackager.pack (/Users/alex/Desktop/Git/Iris/node_modules/app-builder-lib/src/macPackager.ts:192:7)
    at Packager.doBuild (/Users/alex/Desktop/Git/Iris/node_modules/app-builder-lib/src/packager.ts:441:9)
    at Object.executeFinally (/Users/alex/Desktop/Git/Iris/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (/Users/alex/Desktop/Git/Iris/node_modules/app-builder-lib/src/packager.ts:376:31)
    at Packager.build (/Users/alex/Desktop/Git/Iris/node_modules/app-builder-lib/src/packager.ts:337:12)
    at Object.executeFinally (/Users/alex/Desktop/Git/Iris/node_modules/builder-util/src/promise.ts:12:14)
make: *** [build-mac-universal] Error 1

I will push the changes but need to note that the universal build for macOS might not be possible for now.

@alexwkleung alexwkleung linked a pull request Dec 18, 2023 that will close this issue
@alexwkleung
Copy link
Owner Author

Removed electron-vite in d1657e1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Development related future release / plans Plans or improvements for a future release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant