webpack-cli icon indicating copy to clipboard operation
webpack-cli copied to clipboard

fix: respect `NODE_PATH` env variable

Open snitin315 opened this issue 3 years ago • 7 comments

What kind of change does this PR introduce? bugfix

Did you add tests for your changes? No.

If relevant, did you update the documentation? No.

Summary

Fix https://github.com/webpack/webpack-cli/issues/3355

Does this PR introduce a breaking change? No.

Other information No

snitin315 avatar Sep 17 '22 10:09 snitin315

Codecov Report

Merging #3411 (080c6cc) into next (ee91c94) will decrease coverage by 3.16%. The diff coverage is 91.45%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #3411      +/-   ##
==========================================
- Coverage   94.91%   91.74%   -3.17%     
==========================================
  Files          30       22       -8     
  Lines        1690     1587     -103     
  Branches      492      447      -45     
==========================================
- Hits         1604     1456     -148     
- Misses         86      131      +45     
Impacted Files Coverage Δ
packages/generators/src/handlers/react.ts 56.81% <56.81%> (ø)
packages/webpack-cli/bin/cli.js 85.71% <66.66%> (+19.04%) :arrow_up:
packages/serve/src/index.ts 78.94% <78.76%> (-5.33%) :arrow_down:
...ges/webpack-cli/src/utils/dynamic-import-loader.ts 83.33% <83.33%> (ø)
packages/generators/src/index.ts 86.36% <83.78%> (-13.64%) :arrow_down:
packages/generators/src/loader-generator.ts 91.66% <85.71%> (ø)
packages/generators/src/init-generator.ts 85.29% <86.20%> (-12.67%) :arrow_down:
packages/generators/src/addon-generator.ts 92.98% <91.30%> (+0.38%) :arrow_up:
packages/webpack-cli/src/webpack-cli.ts 93.38% <93.38%> (ø)
packages/generators/src/utils/helpers.ts 95.00% <93.75%> (+10.00%) :arrow_up:
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1524ec2...080c6cc. Read the comment docs.

codecov[bot] avatar Sep 17 '22 11:09 codecov[bot]

@snitin315 Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@alexander-akait Please review the new changes.

webpack-bot avatar Sep 19 '22 14:09 webpack-bot

Rebased.

snitin315 avatar Sep 19 '22 15:09 snitin315

Something wrong on CI, debugging.

snitin315 avatar Sep 20 '22 03:09 snitin315

Weird

TypeError: Cannot read properties of undefined (reading 'cli') at WebpackCLI.getBuiltInOptions (D:\a\webpack-cli\webpack-cli\packages\webpack-cli\lib\webpack-cli.js:25743:60) at outputHelp (D:\a\webpack-cli\webpack-cli\packages\webpack-cli\lib\webpack-cli.js:27213:43) at Command. (D:\a\webpack-cli\webpack-cli\packages\webpack-cli\lib\webpack-cli.js:27467:9) at async Promise.all (index 63) at WebpackCLI.run (D:\a\webpack-cli\webpack-cli\packages\webpack-cli\lib\webpack-cli.js:27595:5)

alexander-akait avatar Sep 22 '22 16:09 alexander-akait

On windows CI NODE_PATH is somehow defined.

Screenshot 2022-09-24 at 8 20 30 AM

snitin315 avatar Sep 24 '22 02:09 snitin315

@alexander-akait fixed, I moved the check outside of the loop.

snitin315 avatar Sep 25 '22 11:09 snitin315

And let's add the check if (process.env.NODE_PATH) {}

alexander-akait avatar Sep 26 '22 15:09 alexander-akait

@snitin315 Can you send the same PR for webpack itself too?

alexander-akait avatar Sep 27 '22 18:09 alexander-akait