You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 yieldedconnectSaga.js
is the only place that importbf-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
, thebf-dljs
package will bee tree-shaken off, ifcreateDirectLine
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 viaexport { 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 simplyimport 'botframework-directlinejs'
without using it, it will loadcore-js/features/promise
andrxjs/*
.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 tobotframework-directlinejs
.In contrast, without modifying
connectSaga.js
.When importing from root.
The text was updated successfully, but these errors were encountered: