In our private component profab.lib.attention, a tracked file, which is also required by the main entry file, has this at the first line:
const { WebClient } = require(`@slack/client`)
Other dependencies are properly resolved, but this one seems to be ignored entirely. Bit does not list it as a dependency of the component and so of course, it is not installed when npm installing the component.
I am not sure how to reproduce it. It may be as simple as using any scoped package as a dependency. I may be able to investigate tomorrow.
It seems that Bit does not track scoped packages correctly.
There is a workaround using overrides, so you can add the dependency to the component.
mkdir test-scoped && cd test-scoped
npm init -y && bit init
npm i @slack/client --save
touch slack.js
echo 'const { WebClient } = require(`@slack/client`);' > slack.js
bit add slack.js
bit show slack
See that @slack/client is not listed as a dependency. This can be resolved using overrides. But Bit should detect it.
@m59peacemaker , there is a bug there but it's not about scoped packages, it's about the apostrophe you used with the require statement. Replacing it with a single or double quotes fixes the issue.
In other words:
- const { WebClient } = require(`@slack/client`)
+ const { WebClient } = require('@slack/client')
I'm leaving this task open to fix the issue with the apostrophe.
With the fix above, the require works also with apostrophes.
Most helpful comment
With the fix above, the
requireworks also with apostrophes.