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

refactor: use forge.config.ts in the webpack typescript template #3012

Merged
merged 14 commits into from
Oct 31, 2022

Conversation

MarshallOfSound
Copy link
Member

This also contains a bit of refactoring to avoid adding circular deps

@nickyvanurk
Copy link

nickyvanurk commented Oct 28, 2022

Your forge.config.ts references js files, not ts. Is this a bug? Also the config file had to be .js in my case.

@erickzhao
Copy link
Member

@nickyvanurk

Your forge.config.ts references js files, not ts. Is this a bug?

I think that's a bug from #2991, my bad.

Also the config file had to be .js in my case.

For forge.config.ts, I just tested myself and it seems like the latest release won't auto-detect the file in your root folder.

An unhandled rejection has occurred inside Forge:
Error: Unable to use specified module loaders for ".ts".

Electron Forge was terminated. Location:
{}
error Command failed with exit code 1.

but adding ./forge.config.ts to your package.json should work:

"config": {
    "forge": "./forge.config.ts"
  },

@nickyvanurk
Copy link

nickyvanurk commented Oct 29, 2022

@erickzhao @MarshallOfSound Is there a reason for the config file to have the Typescript extension except that "it feels good"? So far in my development I have yet to see a typescript config file. It's either json or js/csj. To be it seems more trouble than it's worth trying to change this convention (by telling people to put an extra config line in their package.json).

@MarshallOfSound
Copy link
Member Author

@nickyvanurk It makes the config type safe (which IMO is enough of a reason). It also as a side effect adds auto-complete and stuff for the config which makes the devxp of writing configs better. Note we're only making this the default for the typescript template, the non-typescript template will continue to be forge.config.js

@MarshallOfSound MarshallOfSound merged commit b80a275 into main Oct 31, 2022
@MarshallOfSound MarshallOfSound deleted the typed-forge-config-ts branch October 31, 2022 19:50
nelsonni added a commit to EPICLab/synectic that referenced this pull request Dec 12, 2022
nelsonni added a commit to EPICLab/synectic that referenced this pull request Dec 12, 2022
* Bump react-dnd-html5-backend from 15.1.3 to 16.0.1

Bumps [react-dnd-html5-backend](https://github.com/react-dnd/react-dnd) from 15.1.3 to 16.0.1.
- [Release notes](https://github.com/react-dnd/react-dnd/releases)
- [Changelog](https://github.com/react-dnd/react-dnd/blob/main/CHANGELOG.md)
- [Commits](https://github.com/react-dnd/react-dnd/commits)

---
updated-dependencies:
- dependency-name: react-dnd-html5-backend
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove deprecated moduleNameMapper entries react-dnd-html5-backend and react-dnd-touch-backend

* Migrate forge.config.json to forge.config.ts format per electron/forge#3012

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Nelson <nelsonni@oregonstate.edu>
@erikian erikian mentioned this pull request Jan 7, 2023
5 tasks
@jahmezz
Copy link

jahmezz commented May 2, 2023

After making this change, is there still a straightforward way to configure forge's plugins using package.json?
Or should I simply always configure everything using forge.config.ts?

I am looking for a way to recreate this approach people typically take. I haven't found a way to transpile the .ts files in a way that works.

{
"name": "@electron-forge/plugin-webpack",
"config": {
"mainConfig": "./webpack.main.config.js",
"renderer": {
"config": "./webpack.renderer.config.js",
"entryPoints": [{
"name": "main_window",
"html": "./src/renderer/index.html",
"js": "./src/renderer/index.js",
"preload": {
"js": "./src/preload.js"
}
}]
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants