Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/dist/WebpackConfig.js b/dist/WebpackConfig.js
index e1fa82328f112953f963fb7c066f4951611d32cb..4b3422f76253e4470b8ddc522037fa3e5b851c4a 100644
--- a/dist/WebpackConfig.js
+++ b/dist/WebpackConfig.js
@@ -1,7 +1,8 @@
import path from 'node:path';
import debug from 'debug';
import HtmlWebpackPlugin from 'html-webpack-plugin';
-import { DefinePlugin, ExternalsPlugin } from 'webpack';
+import webpackPkg from 'webpack';
+const { DefinePlugin, ExternalsPlugin } = webpackPkg;
import { merge as webpackMerge } from 'webpack-merge';
import AssetRelocatorPatch from './util/AssetRelocatorPatch.js';
import processConfig from './util/processConfig.js';
diff --git a/dist/WebpackPlugin.js b/dist/WebpackPlugin.js
index a42103888da89eb836f4205b5d15aa5e081ee849..dd5ad4c6067b46921cc48e0d921cff886cf60ed1 100644
--- a/dist/WebpackPlugin.js
+++ b/dist/WebpackPlugin.js
@@ -9,7 +9,8 @@ import debug from 'debug';
import glob from 'fast-glob';
import fs from 'fs-extra';
import { PRESET_TIMER } from 'listr2';
-import * as webpack from 'webpack';
+import webpackDefault from 'webpack';
+const webpack = { webpack: webpackDefault };
import WebpackDevServer from 'webpack-dev-server';
import { merge } from 'webpack-merge';
import ElectronForgeLoggingPlugin from './util/ElectronForgeLogging.js';
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@
"update-electron-app": "^3.0.0"
},
"devDependencies": {
"@electron-forge/cli": "8.0.0-alpha.3",
"@electron-forge/maker-deb": "8.0.0-alpha.3",
"@electron-forge/maker-rpm": "8.0.0-alpha.3",
"@electron-forge/maker-squirrel": "8.0.0-alpha.3",
"@electron-forge/maker-zip": "8.0.0-alpha.3",
"@electron-forge/plugin-fuses": "8.0.0-alpha.3",
"@electron-forge/plugin-webpack": "8.0.0-alpha.3",
"@electron-forge/publisher-github": "8.0.0-alpha.3",
"@electron-forge/cli": "8.0.0-alpha.6",
"@electron-forge/maker-deb": "8.0.0-alpha.6",
"@electron-forge/maker-rpm": "8.0.0-alpha.6",
"@electron-forge/maker-squirrel": "8.0.0-alpha.6",
"@electron-forge/maker-zip": "8.0.0-alpha.6",
"@electron-forge/plugin-fuses": "8.0.0-alpha.6",
"@electron-forge/plugin-webpack": "patch:@electron-forge/plugin-webpack@npm%3A8.0.0-alpha.6#~/.yarn/patches/@electron-forge-plugin-webpack-npm-8.0.0-alpha.6-6d62bb130a.patch",
"@electron-forge/publisher-github": "8.0.0-alpha.6",
"@electron/devtron": "^2.1.1",
"@electron/fuses": "^1.6.1",
"@electron/lint-roller": "^3.1.3",
Expand Down Expand Up @@ -161,8 +161,8 @@
]
},
"resolutions": {
"@electron-forge/maker-base": "8.0.0-alpha.3",
"@electron-forge/shared-types": "8.0.0-alpha.3"
"@electron-forge/maker-base": "8.0.0-alpha.6",
"@electron-forge/shared-types": "8.0.0-alpha.6"
},
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f",
"dependenciesMeta": {
Expand Down
5 changes: 5 additions & 0 deletions src/main/devtron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { isDevMode } from './utils/devmode';

if (isDevMode()) {
require('@electron/devtron').devtron.install();
}
21 changes: 7 additions & 14 deletions src/main/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// eslint-disable-next-line import/order -- this needs to happen first in execution
import { initSentry } from './sentry';
initSentry();

// eslint-disable-next-line import/order -- Devtron needs to be imported and installed before any ipcMain calls are set up.
import { isDevMode } from './utils/devmode';
if (isDevMode()) {
// `install` returns a Promise, but we don't have access to top-level await in CommonJS
void require('@electron/devtron').devtron.install();
}
// These imports have side effects that must run before any ipcMain handlers
// are registered. ESM hoists all static imports, so side effects must live
// in the imported modules themselves, not in interleaved body code.
import './sentry';
import './devtron';

import {
BrowserWindow,
Expand All @@ -32,6 +27,7 @@ import { shouldQuit } from './squirrel';
import { setupTemplates } from './templates';
import { setupThemes } from './themes';
import { setupUpdates } from './update';
import { isDevMode } from './utils/devmode';
import { getProjectName } from './utils/get-project-name';
import { getUsername } from './utils/get-username';
import { setupVersions } from './versions';
Expand Down Expand Up @@ -229,7 +225,4 @@ export function main(argv_in: string[]) {
});
}

// only call main() if this is the main module
if (typeof module !== 'undefined' && require.main === module) {
main(process.argv);
}
main(process.argv);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what originally motivated this? Wondering if we should keep it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure but as a note I specifically changed this around because require.main === module was tripping over module: preserve.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context for the change here: b30d4c3

I'm a little concerned this might cause a regression in tests, but at the same time they're going green. 🤔

6 changes: 2 additions & 4 deletions src/main/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import * as Sentry from '@sentry/electron/main';
import { isDevMode } from './utils/devmode';
import { SENTRY_DSN } from '../constants';

export function initSentry() {
if (!isDevMode()) {
Sentry.init({ dsn: SENTRY_DSN });
}
if (!isDevMode()) {
Sentry.init({ dsn: SENTRY_DSN });
}
4 changes: 2 additions & 2 deletions src/renderer/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ monaco.languages.registerDocumentFormattingEditProvider('javascript', {
singleQuote: true,
parser: 'babel',
trailingComma: 'none',
plugins: [prettierPluginBabel, prettierPluginESTree],
plugins: [prettierPluginBabel, prettierPluginESTree as never],
});
return [
{
Expand All @@ -37,7 +37,7 @@ monaco.languages.registerDocumentRangeFormattingEditProvider('javascript', {
singleQuote: true,
parser: 'babel',
trailingComma: 'none',
plugins: [prettierPluginBabel, prettierPluginESTree],
plugins: [prettierPluginBabel, prettierPluginESTree as never],
});
return [
{
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/utils/get-package.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fiddlePackageJSON from '../../../package.json';
import fiddlePackageJSON from '../../../package.json';
import { MAIN_JS, PackageJsonOptions } from '../../interfaces';
import { AppState } from '../../renderer/state';

Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"module": "preserve",
"moduleResolution": "bundler",
"allowJs": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
Expand All @@ -18,8 +20,9 @@
"importHelpers": true,
"noEmitHelpers": true,
"jsx": "react",
"typeRoots": ["./node_modules/@types"],
"baseUrl": "."
"paths": {
"src/*": ["./src/*"]
}
},
"include": ["src/**/*", "tests/**/*"],
"exclude": ["node_modules/**/*"]
Expand Down
Loading
Loading