Deluze / electron-vue-template

Simple Vue3 + Electron starter template in TypeScript, including ViteJS and Electron Builder
MIT License
579 stars 108 forks source link

Enable Node ESM #6

Closed alexsedeke closed 2 years ago

alexsedeke commented 2 years ago

While some packages like chalk start to be ESM only, we need to swap our project from CJS to ESM. Electron currently has a problem here, which however only relates to files that it receives through the configuration. (https://github.com/electron/electron/issues/21457) This is currently the cleanest solution to this problem, as we continue to declare the project as a pure ESM (package.json: ` type "=" module ") and do not use any other auxiliary packages to achieve this.

Deluze commented 2 years ago

Sorry for the late response, I've been quite busy the last days and haven't made time for your PR.

I think it's a good addition to this template, I too, noticed that starting from version 5.x, the chalk package is ESM only. I'll test and see if everything still works as expected.

Any reasons why you removed the package-lock.json, and updated the .gitignore file? I don't think there were any problems with files being ignored, so I don't see a reason to why we should exclude a lot more directories than necessary.

I also see there are a lot of code style changes, I think I should add some kind of linter to the project too, the styling was already super inconsistent.

Deluze commented 2 years ago

Closing this now, since we moved to typescript compiler and can now use ESM imports.