bundlesize icon indicating copy to clipboard operation
bundlesize copied to clipboard

Absolute paths for config files don't work

Open gcoombe opened this issue 6 years ago • 2 comments

Do you want to request a feature or report a bug?

Report bug

What is the current behavior?

Due to how cosmicConfig is being used specifying an absolute path to a config file does't work. When specifying a --config arg the value is passed into searchPlaces. However this is meant to be a place that cosmicConfig looks at each level as it traverses up the directory not a path.

Something like --config ../foo.config.js also doesn't work

If the current behavior is a bug, please provide the steps to reproduce.

To repro:

  • Try something like bundlesize --config ../foo.json or bundlesize --config /Users/gcoombe/apps/bundlesize.json

What is the expected behavior?

Absolute paths or relative paths not within the cwd or subdirectory should work,

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information. [email protected]

gcoombe avatar Jul 25 '19 21:07 gcoombe

I can try and submit a PR but it seems like if we're specifying a config arg we should just treat it like a path and not use cosmicConfig. I'm not sure what we're attempting to gain with this dependency.

gcoombe avatar Jul 25 '19 21:07 gcoombe

Part 1: Verified that absolute path doesn't work. (cosmic-config prepends the current directory to path)

Part 2: I was able to make --config ../foo.config.js work, check out the tests in https://github.com/siddharthkp/bundlesize/pull/327. Can you create a small reproduction repo for this? (Or modify the tests to reproduce this)

siddharthkp avatar Jul 26 '19 12:07 siddharthkp