Skip to content

Commit b583b0f

Browse files
committed
Use webpack-env typings instead of node typings in rush-sdk
1 parent 31085f2 commit b583b0f

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libraries/rush-sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@rushstack/heft": "workspace:*",
2828
"@rushstack/heft-node-rig": "workspace:*",
2929
"@types/heft-jest": "1.0.1",
30-
"@types/node": "12.20.24",
31-
"@types/semver": "7.3.5"
30+
"@types/semver": "7.3.5",
31+
"@types/webpack-env": "1.13.0"
3232
}
3333
}

libraries/rush-sdk/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ declare const global: NodeJS.Global &
3131
___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;
3232
};
3333

34-
// eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-explicit-any
35-
declare const __non_webpack_require__: ((moduleName: string) => any) | undefined;
3634
function _require<TResult>(moduleName: string): TResult {
3735
if (typeof __non_webpack_require__ === 'function') {
36+
// If this library has been webpacked, we need to call the real `require` function
37+
// that doesn't get turned into a __webpack_require__ statement
3838
return __non_webpack_require__(moduleName);
3939
} else {
4040
return require(moduleName);

libraries/rush-sdk/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",
33
"compilerOptions": {
4-
"types": ["heft-jest", "node"]
4+
"types": [
5+
"heft-jest",
6+
"webpack-env" // Use webpack-env here instead of node so we have __non_webpack_require__
7+
]
58
}
69
}

0 commit comments

Comments
 (0)