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

Bolt add fails when adding a dot separated dependency in certain cases #272

Open
Blasz opened this issue Mar 26, 2020 · 1 comment
Open

Comments

@Blasz
Copy link
Collaborator

Blasz commented Mar 26, 2020

I ran into an edge case when trying to add lodash to a package that had lodash.union installed.

⚡️   bolt v0.24.4 (node v12.3.1)
error TypeError: Cannot read property '0' of undefined
error     at sort (/Users/mblaszczyk/.config/yarn/global/node_modules/sort-object/index.js:71:29)
error     at Package._updateDependencies (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/Package.js:136:43)
error     at Package.setDependencyVersionRange (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/Package.js:110:16)
error     at addDependenciesToPackage (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/utils/addDependenciesToPackages.js:107:15)
error     at async Object.workspaceAdd (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/commands/workspace/add.js:76:3)
error     at async cli (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/cli.js:347:5)

The sort-object npm module treats keys with dots in them as nested object keys. If both lodash and lodash.xxx exist, it falls over completely.

I think we should just sort the object ourselves.

@slatlasdev
Copy link

This is still a problem in 2024.

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

2 participants