Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundlewatch throws an exception if there is no package.json in the current directory. #434

Open
rogersd opened this issue Aug 4, 2021 · 0 comments

Comments

@rogersd
Copy link

rogersd commented Aug 4, 2021

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

Bug report.

What is the current behavior?

Bundlewatch throws an exception if there is no package.json in the current directory, even when passing --config

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

  1. From a directory with no package.json, run /usr/local/bin/npx bundlewatch --config foo.json. The following exception will occur:
TypeError: Cannot read property 'bundlewatch' of undefined
    at determineConfig (/Users/drogers/.npm/_npx/3805/lib/node_modules/bundlewatch/lib/bin/determineConfig.js:70:36)
    at main (/Users/drogers/.npm/_npx/3805/lib/node_modules/bundlewatch/lib/bin/index.js:51:47)
    at mainSafe (/Users/drogers/.npm/_npx/3805/lib/node_modules/bundlewatch/lib/bin/index.js:102:29)
    at Object.<anonymous> (/Users/drogers/.npm/_npx/3805/lib/node_modules/bundlewatch/lib/bin/index.js:149:1)
    at Module._compile (internal/modules/cjs/loader.js:1251:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)
    at Module.load (internal/modules/cjs/loader.js:1100:32)
    at Function.Module._load (internal/modules/cjs/loader.js:962:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at /usr/local/lib/node_modules/npm/node_modules/libnpx/index.js:268:14
[FATAL] Uncaught exception

What is the expected behavior?

The missing package.json should be ignored, and the proviced config file used.

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

Please mention other relevant information such as the browser version, Node.js version, bundlewatch version, and Operating System.

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

No branches or pull requests

1 participant