oklas / react-app-alias

:label: Alias and multiple src directory for craco or rewired create-react-app
MIT License
174 stars 18 forks source link

Cannot convert undefined or null to object if there are no dependencies #81

Open nullnullend opened 2 years ago

nullnullend commented 2 years ago

I have a monorepository where some child package.json is missing dependencies.

{
  "name": "@project/client",
  "version": "1.0.9",
  "private": true,
  "scripts": {
    "start": "cross-env BROWSER=none PORT=3200 craco start",
    "build": "cross-env craco build",
  }
}

I get this error:

E:\project\node_modules\react-app-alias-ex\src\index.js:58
  const list = [].concat(...depsSections.map(s => Object.keys(pack[s])))

TypeError: Cannot convert undefined or null to object
oklas commented 2 years ago

Can you make a PR?

nullnullend commented 2 years ago

I can create, correct a mistake. But the problem is actually bigger than that. With this structure, the list of dependencies is not correct. They are in the root package.json file.

oklas commented 2 years ago

Doesn't it take dependencies from root package.json?

What do you mean by "this structure"? Empty list of deps? It imports that deps, which is declared.

пт, 22 июл. 2022 г. в 12:11, Serguei Okladnikov @.***>:

Doesn't it take dependencies from root package.json?

What do you mean by "this structure"? Empty list of deps? It imports that deps, which is declared.

пт, 22 июл. 2022 г., 11:04 Oleg Sartakov @.***>:

I can create, correct a mistake. But the problem is actually bigger than that. With this structure, the list of dependencies is not correct. They are in the root package.json file.

— Reply to this email directly, view it on GitHub https://github.com/oklas/react-app-alias/issues/81#issuecomment-1192299320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB57HXCRNYVH2BU5U2JDEP3VVJIZ5ANCNFSM54EAC2AA . You are receiving this because you commented.Message ID: @.***>

oklas commented 2 years ago

Doesn't it take dependencies from root package.json?

What do you mean by "this structure"? Empty list of deps? It imports that deps, which is declared.

пт, 22 июл. 2022 г., 11:04 Oleg Sartakov @.***>:

I can create, correct a mistake. But the problem is actually bigger than that. With this structure, the list of dependencies is not correct. They are in the root package.json file.

— Reply to this email directly, view it on GitHub https://github.com/oklas/react-app-alias/issues/81#issuecomment-1192299320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB57HXCRNYVH2BU5U2JDEP3VVJIZ5ANCNFSM54EAC2AA . You are receiving this because you commented.Message ID: @.***>