-
-
Notifications
You must be signed in to change notification settings - Fork 522
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
"type": "module" in package.json for Vite templates #3502
Comments
I just went through this. Change |
@jdms754, I followed your steps but got this error: |
@jdms754 thanks a lot. That's worked! |
@jdms754 I have started fresh and it worked now. thank you! ❤️ the difference I had was that in the |
What about when one wants to use moduleResolution bundler? moduleResolution NodeNext isn't technically correct given that forge uses vite/webpack to build the project. |
Thanks!
|
@joezappie any luck on figuring this out? I was also confused by why your gh issue xxx was closed when it does not appear ESM has been addressed with the vite-typescript template as in v7.4 I still see commonjs in tsconfig and the build > lib > format as 'cjs' in the vite config. Thanks in advance if there is any help you can provide me based on your own troubleshooting and research! |
I have not had any luck in getting esm to work in main yet. I ended up just using electron-vite for my current project instead. Hopefully I can switch back to forge in the near future once this is supported. |
Here is a commit showing changes to use bundler module resolution with Vite + TypeScript template. I had to make |
Thanks for your contribution, I have used esm. |
This issue has been VASTLY helpful. Thanks, @cherewaty , and especially Mr. @jdms754 !! So about |
|
Hi I created a template for my game engine. some time ago I found a way to use get but this is not the best because as vitejs points out to me: I don't know if there is currently a way to make forge elecron work with "type": "module". However adding it to the base template would help many |
Pre-flight checklist
Electron Forge version
7.3.0
Electron version
29.0.1
Operating system
macOS 14.3.1
Last known working Electron Forge version
No response
Expected behavior
I wanted to try out the newly stable
@remix-run/dev
Vite plugin in combination withelectron-forge
. I initialized a new project with thecreate-electron-app
vite-typescript
template, then started layering on pieces likedev
andbuild
scripts inpackage.json
.Actual behavior
I got
remix vite:dev
working with an isolatedvite.remix.config.ts
, but thenremix vite:build
ran intoSyntaxError: Cannot use import statement outside a module
. Adding"type": "module"
tomy-app
'spackage.json
seemed to fix the problem, but thenelectron-forge
scripts started failing.Steps to reproduce
For
vite-typescript
template:npm init [email protected] my-app -- --template=vite-typescript
"type": "module"
topackage.json
.npm start
For
vite
template:npm init [email protected] my-app -- --template=vite
"type": "module"
topackage.json
.npm start
Additional information
Seems related to #3439, and does not appear to be solved with #3468
This is likely causing friction still with SvelteKit as well.
The text was updated successfully, but these errors were encountered: