build: drop @types/webpack-env in favor of webpack/module types#47798
build: drop @types/webpack-env in favor of webpack/module types#47798dsanders11 merged 2 commits intomainfrom
Conversation
| } | ||
| 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'); |
There was a problem hiding this comment.
Can we not map this magically somehow in TS, declaring the type of non_webpack_require better or something?
There was a problem hiding this comment.
Not that I'm aware of. If we could, it would also be a bit tricky because it would be mapping internal/modules/run_main to ../third_party/electron_node/lib/internal/modules/run_main implicitly, which would be coupling __non_webpack_require__ to just requiring modules from ../third_party/electron_node which probably isn't something we want.
There was a problem hiding this comment.
I think defining it as internal/* mapping to ../third_party/electron_node/lib/internal/$1 is fine if that's possible?
0554134 to
ad0d440
Compare
ad0d440 to
830ffb9
Compare
|
No Release Notes |
|
I was unable to backport this PR to "37-x-y" cleanly; |
|
I was unable to backport this PR to "36-x-y" cleanly; |
|
I have automatically backported this PR to "38-x-y", please check out #48015 |
|
@dsanders11 has manually backported this PR to "37-x-y", please check out #48046 |
|
@dsanders11 has manually backported this PR to "36-x-y", please check out #48047 |
…tron#47798) * build: drop @types/webpack-env in favor of webpack/module types * chore: improve type when assigning to global.require
Description of Change
This change was prompted by #47621 which is trying to bring in the latest
@types/webpack-envand causing TS build errors due to conflicting types. Webpack addedmodule.d.tsin v5.62.0, which serves the same purpose as@types/webpack-env, so this PR switches to it and drops@types/webpack-env.This PR also adds a path mapping in
tsconfig.jsonto map@node/*to../third_party/electron_nodeand types the requires of Node.js modules so that we get accurate types for them, which required tweaking our existing types a bit.Checklist
Release Notes
Notes: none