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

fix: handle webpack configs exported as default #3427

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

MarshallOfSound
Copy link
Member

Although you can do ./webpack.main.config.ts currently you still have to do module.exports = config instead of export default config. This handles the default export in the same way that our forge config resolver does

@MarshallOfSound MarshallOfSound requested a review from a team as a code owner November 28, 2023 22:41
@MarshallOfSound MarshallOfSound merged commit 450d9d0 into main Nov 29, 2023
7 checks passed
@MarshallOfSound MarshallOfSound deleted the allow-esm-webpack-config branch November 29, 2023 01:05
@easternmotors
Copy link

@MarshallOfSound Might be a similar issue with the Forge config file itself as well. I know this issue was for the webpack configs themselves but just wondered if this was something Forge wanted to support in 7.x (since it may have inadvertently supported it in 6.x).

Context

I compile my forge.config.ts into forge.config.js using the following tsconfig.json:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "ignoreDeprecations": "5.0",
    "resolveJsonModule": true,
    "sourceMap": true
  },
  "extends": "@tsconfig/node-lts-strictest/tsconfig.json"
}

My forge.config.ts looks something like this:

import type { ForgeConfig } from '@electron-forge/shared-types';

const config: ForgeConfig = { ... };

export default config;

Using Electron Forge 6.4.2, I can compile and I can start/make without any errors. When upgrading to 7.x (including testing on 7.2.0) this fails for me.

Workaround

Changing my forge.config.ts to the following works:

import type { ForgeConfig } from '@electron-forge/shared-types';

const config: ForgeConfig = { ... };

// @ts-expect-error 
export = config;

Again, if this isn't something Forge wants to officially support I totally get in and wanted to at least throw the workaround in here without cluttering the issue board.

Brooooooklyn referenced this pull request in toeverything/AFFiNE Dec 11, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@electron-forge/maker-base](https://github.com/electron/forge) | [`7.1.0` -> `7.2.0`](https://renovatebot.com/diffs/npm/@electron-forge%2fmaker-base/7.1.0/7.2.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@electron-forge%2fmaker-base/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@electron-forge%2fmaker-base/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@electron-forge%2fmaker-base/7.1.0/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@electron-forge%2fmaker-base/7.1.0/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>electron/forge (@&#8203;electron-forge/maker-base)</summary>

### [`v7.2.0`](https://github.com/electron/forge/releases/tag/v7.2.0)

[Compare Source](https://github.com/electron/forge/compare/v7.1.0...v7.2.0)

#### What's Changed

##### Features

-   feat: add support for sequential groups of webpack builds by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3435](https://github.com/electron/forge/pull/3435)

##### Fixes

-   fix: handle webpack configs exported as default by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3427](https://github.com/electron/forge/pull/3427)
-   fix: set empty publicPath for preload scripts by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3428](https://github.com/electron/forge/pull/3428)
-   fix: ensure that webpack is run once per arch for universal builds by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3433](https://github.com/electron/forge/pull/3433)

##### Documentation

-   docs: remove mention of v5 -> v6 migration by [@&#8203;erickzhao](https://github.com/erickzhao) in [https://github.com/electron/forge/pull/3412](https://github.com/electron/forge/pull/3412)
-   docs: add notes on publishing a new monorepo package by [@&#8203;erickzhao](https://github.com/erickzhao) in [https://github.com/electron/forge/pull/3415](https://github.com/electron/forge/pull/3415)

##### Other Changes

-   build(docs): enable API documentation builds for Forge v7 by [@&#8203;erickzhao](https://github.com/erickzhao) in [https://github.com/electron/forge/pull/3413](https://github.com/electron/forge/pull/3413)
-   ci: allow manual API documentation publish by [@&#8203;dsanders11](https://github.com/dsanders11) in [https://github.com/electron/forge/pull/3414](https://github.com/electron/forge/pull/3414)
-   refactor: dedupe key resolver for static publishers by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3421](https://github.com/electron/forge/pull/3421)
-   chore: bump electronjs/node to 2.1.0 (main) by [@&#8203;electron-roller](https://github.com/electron-roller) in [https://github.com/electron/forge/pull/3422](https://github.com/electron/forge/pull/3422)
-   chore: update deps to clear some audit warnings by [@&#8203;dsanders11](https://github.com/dsanders11) in [https://github.com/electron/forge/pull/3429](https://github.com/electron/forge/pull/3429)

**Full Changelog**: electron/forge@v7.1.0...v7.2.0

![image](https://github.com/electron/forge/assets/33054982/9c4d7096-4942-419a-96b1-123c197e5cf6)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44MS4zIiwidXBkYXRlZEluVmVyIjoiMzcuODEuMyIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSJ9-->
Brooooooklyn referenced this pull request in toeverything/AFFiNE Dec 11, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@electron-forge/maker-base](https://github.com/electron/forge) | [`7.1.0` -> `7.2.0`](https://renovatebot.com/diffs/npm/@electron-forge%2fmaker-base/7.1.0/7.2.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@electron-forge%2fmaker-base/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@electron-forge%2fmaker-base/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@electron-forge%2fmaker-base/7.1.0/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@electron-forge%2fmaker-base/7.1.0/7.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>electron/forge (@&#8203;electron-forge/maker-base)</summary>

### [`v7.2.0`](https://github.com/electron/forge/releases/tag/v7.2.0)

[Compare Source](https://github.com/electron/forge/compare/v7.1.0...v7.2.0)

#### What's Changed

##### Features

-   feat: add support for sequential groups of webpack builds by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3435](https://github.com/electron/forge/pull/3435)

##### Fixes

-   fix: handle webpack configs exported as default by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3427](https://github.com/electron/forge/pull/3427)
-   fix: set empty publicPath for preload scripts by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3428](https://github.com/electron/forge/pull/3428)
-   fix: ensure that webpack is run once per arch for universal builds by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3433](https://github.com/electron/forge/pull/3433)

##### Documentation

-   docs: remove mention of v5 -> v6 migration by [@&#8203;erickzhao](https://github.com/erickzhao) in [https://github.com/electron/forge/pull/3412](https://github.com/electron/forge/pull/3412)
-   docs: add notes on publishing a new monorepo package by [@&#8203;erickzhao](https://github.com/erickzhao) in [https://github.com/electron/forge/pull/3415](https://github.com/electron/forge/pull/3415)

##### Other Changes

-   build(docs): enable API documentation builds for Forge v7 by [@&#8203;erickzhao](https://github.com/erickzhao) in [https://github.com/electron/forge/pull/3413](https://github.com/electron/forge/pull/3413)
-   ci: allow manual API documentation publish by [@&#8203;dsanders11](https://github.com/dsanders11) in [https://github.com/electron/forge/pull/3414](https://github.com/electron/forge/pull/3414)
-   refactor: dedupe key resolver for static publishers by [@&#8203;MarshallOfSound](https://github.com/MarshallOfSound) in [https://github.com/electron/forge/pull/3421](https://github.com/electron/forge/pull/3421)
-   chore: bump electronjs/node to 2.1.0 (main) by [@&#8203;electron-roller](https://github.com/electron-roller) in [https://github.com/electron/forge/pull/3422](https://github.com/electron/forge/pull/3422)
-   chore: update deps to clear some audit warnings by [@&#8203;dsanders11](https://github.com/dsanders11) in [https://github.com/electron/forge/pull/3429](https://github.com/electron/forge/pull/3429)

**Full Changelog**: electron/forge@v7.1.0...v7.2.0

![image](https://github.com/electron/forge/assets/33054982/9c4d7096-4942-419a-96b1-123c197e5cf6)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44MS4zIiwidXBkYXRlZEluVmVyIjoiMzcuODEuMyIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSJ9-->
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.

4 participants