Skip to content

fix: config path problem on windows#4501

Merged
lukastaegert merged 2 commits intorollup:masterfrom
pos777:fix-windows-config-path
May 19, 2022
Merged

fix: config path problem on windows#4501
lukastaegert merged 2 commits intorollup:masterfrom
pos777:fix-windows-config-path

Conversation

@pos777
Copy link
Copy Markdown
Contributor

@pos777 pos777 commented May 18, 2022

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

resolves #3949
#4260
#4439
#4440
#4446
resolves #4465

Description

The loadConfigFromBundledFile function patches the default require algorithm for the fileName file. It replaces the require.extensions handler for it. In certain scenarios the file name parameter value in the require.extensions handler differs from the required file name (for example for symlinked files). The #3783 fix processed this by preparing the input file name before comparation. It uses the fsPromises.realpath function for it. The problem is that the fsPromises.realpath result and the file name in the require.extensions handler are not the same in certain scenarios (refer to the relevant issue list above). I suggest use the require.resolve function instead of the fsPromises.realpath because the require and the require.resolve functions use the same algorithm.

@codecov
Copy link
Copy Markdown

codecov bot commented May 19, 2022

Codecov Report

Merging #4501 (916df46) into master (931a199) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4501   +/-   ##
=======================================
  Coverage   98.74%   98.74%           
=======================================
  Files         207      207           
  Lines        7342     7342           
  Branches     2081     2081           
=======================================
  Hits         7250     7250           
  Misses         33       33           
  Partials       59       59           
Impacted Files Coverage Δ
cli/run/loadConfigFile.ts 94.33% <100.00%> (ø)

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 931a199...916df46. Read the comment docs.

Copy link
Copy Markdown
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thank you so much! The solution is perfect.

@lukastaegert lukastaegert merged commit bf1ff32 into rollup:master May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rollup with Configuration Fails on Windows subst drive rollup with --preserve-symlinks erroneously assumes all configs are commonjs

2 participants