build: drop @types/webpack-env in favor of webpack/module types (#48047)

* build: drop @types/webpack-env in favor of webpack/module types

* chore: improve type when assigning to global.require
This commit is contained in:
David Sanders 2025-08-12 05:10:30 -07:00 committed by GitHub
commit 116c24aaf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 24 additions and 25 deletions

View file

@ -65,9 +65,9 @@ require('@electron/internal/renderer/common-init');
if (nodeIntegration) {
// Export node bindings to global.
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
global.module = new Module('electron/js2c/renderer_init');
global.require = makeRequireFunction(global.module);
global.require = makeRequireFunction(global.module) as NodeRequire;
// Set the __filename to the path of html file if it is file: protocol.
if (window.location.protocol === 'file:') {
@ -150,7 +150,7 @@ if (cjsPreloads.length) {
}
}
if (esmPreloads.length) {
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
// Load the preload scripts.