-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Is your feature request related to a problem?
When using Web Chat outside of DirectLineJS, the botframework-directlinejs is always loaded regardless of how tree shaking is done.
Describe the suggestion or request in detail
Searching the code for importing botframework-directlinejs, it yielded connectSaga.js is the only place that import bf-dljs implementation code.
For other places, it's either intentionally importing (say, createDirectLine), or only importing its typing (i.e. import type {} from 'bf-dljs'.
After some experiments, it is clear that after decoupling DLJS in connectSaga.js, the bf-dljs package will bee tree-shaken off, if createDirectLine is not loaded.
However, more work need to be done on exporting ReactWebChat alone. Instead of exporting it like today, we need to export it via export { ReactWebChat } from 'botframework-webchat/ReactWebChat.
Describe alternatives you have considered
I tested that export { ReactWebChat } from 'botframework-webchat' does not help tree-shaking. This is because by simply import 'botframework-directlinejs' without using it, it will load core-js/features/promise and rxjs/*.
We need named exports to make sure tree-shaking works properly.
More details at https://github.com/compulim/experiment-treeshake-directlinejs/.
Additional context
Based on 4.15.7. After connectSaga.js removed reference to botframework-directlinejs.
import { ReactWebChat } from 'botframework-webchat/lib/FullReactWebChat';
console.log(ReactWebChat);In contrast, without modifying connectSaga.js.
When importing from root.


