webpack-cli
webpack-cli copied to clipboard
fix: attempts custom package require without path exists check
What kind of change does this PR introduce?
Bugfix
Did you add tests for your changes?
No
If relevant, did you update the documentation?
Yes
Summary
Firstly this change fixes an issue that looks like a copy-paste error: Custom WEBPACK_DEV_SERVER_PACKAGE would be conditioned on WEBPACK_PACKAGE to exist.
The next change, using require.resolve, widens the usefulness of the override. With plain existsSync
you basically need an absolute path, unless you know what the current working directory will be when using the override.
Does this PR introduce a breaking change?
I don't think so. Existing WEBPACK_PACKAGE or WEBPACK_DEV_SERVER_PACKAGE would have satisfied fs.existsSync(require.resolve(path)))
if they worked.
Other information
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: solsson (440dfb97cd799081eaf6caba883c8982884ce817, fc9797e66b337f6cd776115c9960c2674e968196, e86416e583fd32b801fa5cbeceef4628016d7fbb)
Thanks, can you accept CLA?
CLA signed.
Actually if the existsSync
check causes any issues I'd be in favor of dropping it. These envs have distinct names that are unlikely to collide with other use of evns. Silently dropping them might cause more confusion than attempting the require regardless of value.
I will force push to only the first commit, then get one commit at a time through CI.
Codecov Report
Merging #3161 (7a83488) into master (af820d2) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #3161 +/- ##
=======================================
Coverage 91.44% 91.45%
=======================================
Files 23 23
Lines 1719 1721 +2
Branches 519 519
=======================================
+ Hits 1572 1574 +2
Misses 147 147
Impacted Files | Coverage Δ | |
---|---|---|
packages/webpack-cli/src/webpack-cli.ts | 93.96% <100.00%> (+0.01%) |
:arrow_up: |
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 af820d2...7a83488. Read the comment docs.
@solsson can you fix lint?
@solsson Thanks for your update.
I labeled the Pull Request so reviewers will review it again.
@rishabh3112 Please review the new changes.
@solsson Hello, do you have time to finish this PR? Because it is easy to fix lint, thank you