mapbox / mapbox/node-pre-gyp

mock-aws-s3, aws-sdk, nock dependencies vs devDependencies issue

Open
#661 74 comments 99 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.2k
Forks
271
Avg merge
23h 40m
Merged PRs (30d)
2

Description

Usage of `mock-aws-s3`, `aws-sdk`, and `nock` are used in the call stack originating from `lib/node-pre-gyp.js` (which is the package `main`), but they are only listed in `"devDependencies"`.

```
"aws-sdk": "^2.1012.0",
"mock-aws-s3": "^4.0.2",
"nock": "^13.1.4",
```

This causes a problem with webpack:

```
ERROR in ../project/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 43:20-42
Module not found: Error: Can't resolve 'mock-aws-s3' in '/Path/to/project/node_modules/@mapbox/node-pre-gyp/lib/util'
@ ../project/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
@ ../project/node_modules/bcrypt/bcrypt.js 3:17-48
@ ./src/lib/server/initialize.ts 3:0-69 9:12-39 21:23-56
@ ./src/index.ts 12:0-53 51:4-19

ERROR in ../project/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 76:14-32
Module not found: Error: Can't resolve 'aws-sdk' in '/Path/to/project/node_modules/@mapbox/node-pre-gyp/lib/util'
@ ../project/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
@ ../project/node_modules/bcrypt/bcrypt.js 3:17-48
@ ./src/lib/server/initialize.ts 3:0-69 9:12-39 21:23-56
@ ./src/index.ts 12:0-53 51:4-19

ERROR in ../project/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 112:15-30
Module not found: Error: Can't resolve 'nock' in '/Path/to/project/node_modules/@mapbox/node-pre-gyp/lib/util'
@ ../project/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
@ ../project/node_modules/bcrypt/bcrypt.js 3:17-48
@ ./src/lib/server/initialize.ts 3:0-69 9:12-39 21:23-56
@ ./src/index.ts 12:0-53 51:4-19
```

Either those modules should be moved to `"dependencies"`, or the main call chain should never hit them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the dependency declarations and the call chain from lib/node-pre-gyp.js into lib/util/s3_setup.js. Reproduce the reported webpack resolution errors and determine whether the modules should be runtime dependencies or the call chain should avoid them. Done means the affected webpack build resolves successfully without introducing an invalid dependency classification.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.