ember-fastboot / ember-fastboot/ember-cli-fastboot
bug: Fastboot Dependencies Whitelist breaks node_modules resolution expectations
- Dominant language
- JavaScript
- Stars
- 850
- Forks
- 161
- Avg merge
- 17h 45m
- Merged PRs (30d)
- 19
Description
the effects of this bug are that fastboot cannot be used in conjunction with more recent versions of yarn, pnpm, or pnp strategies that avoid hoisting dependencies to root.
This affects resolution of whitelisted dependencies *both* from the project *and* from addons it consumes.
For instance, [ember-fetch](https://github.com/ember-cli/ember-fetch/blob/40867376fdb736b5d6dd7df58a27fbc3cddb09a5/package.json#L100) declares both a `dependency` and whitelistes `abortcontroller-polyfill`. Even if the consuming app also adds `abortcontroller-polyfill` to its dependencies and adds the same whitelisted values, when hoisting does not occur this will fail to be resolved by the [sandboxedRequire provided by fastboot-schema.js](https://github.com/ember-fastboot/ember-cli-fastboot/blob/703e78832fbb8d4c9d9ace9d9aee6a4e7a72bed5/packages/fastboot/src/fastboot-schema.js#L170) which scopes to a directory that will not be able to see it and executes from a directory that does not have the parent project in its path.
Example failure of this in which the parent project has re-declared the dependency and re-declared the whitelisted values:
```
Error: Cannot find module 'abortcontroller-polyfill/dist/cjs-ponyfill'
Require stack:
- /Users/cthoburn/github/data/node_modules/.pnpm/fastboot@3.3.2/node_modules/fastboot/src/fastboot-schema.js
- /Users/cthoburn/github/data/node_modules/.pnpm/fastboot@3.3.2/node_modules/fastboot/src/ember-app.js
- /Users/cthoburn/github/data/node_modules/.pnpm/fastboot@3.3.2/node_modules/fastboot/src/index.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli-fastboot-testing@0.6.0_webpack@5.74.0/node_modules/ember-cli-fastboot-testing/lib/helpers.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli-fastboot-testing@0.6.0_webpack@5.74.0/node_modules/ember-cli-fastboot-testing/index.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli@4.8.0/node_modules/ember-cli/lib/models/package-info-cache/package-info.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli@4.8.0/node_modules/ember-cli/lib/models/package-info-cache/index.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli@4.8.0/node_modules/ember-cli/lib/models/project.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli@4.8.0/node_modules/ember-cli/lib/utilities/get-config.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli@4.8.0/node_modules/ember-cli/lib/utilities/instrumentation.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli@4.8.0/node_modules/ember-cli/lib/cli/index.js
- /Users/cthoburn/github/data/node_modules/.pnpm/ember-cli@4.8.0/node_modules/ember-cli/bin/ember
```
Contributor guide
Assessment
This issue has not been assessed yet.