-
Notifications
You must be signed in to change notification settings - Fork 76
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
chore(templates/react): add webpack entries to all templates #962
Conversation
d7ba180
to
5b60bf2
Compare
@@ -0,0 +1,19 @@ | |||
import { DevApp } from '@botonic/react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave all templates as they are except the ones about webchat & webviews for several reasons:
- minimize changes
- to make examples simpler, to avoid scaring developers if templates are too complex
- in case we refactor botonic in the future, it will be easier to modify 1 file per bot rather than 4 files per bot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were talking about this with @marcrabat yesterday, and we finally decided to go this way because:
- It is a sure and simple way to enforce tree shaking of each artifact.
- We avoid the "magic" of webpack aliases, I think that's more confusing for the developer than having some extra files with a clear purpose. It provides clarity about how things are built and also provides flexibility in case they want to modify the entry points.
- This is actually more future proof than the old version, as we "eject" the entry files to the project code, we no longer need to keep that file in botonic source code, so we don't need to worry about backwards compatibility (that responsibility is no longer in botonic). Developers will be able to upgrade botonic versions in their old project without worrying about having to change their webpack config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with separating the entry files, but I was suggesting that for the templates which have no webchat nor webviews, it was a bit confusing having so many files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it's better to have all of them already set up in case the developer wants to add webviews or webchat later (which can be very common). Otherwise the developer should need to research these files somewhere and I think won't be favourable for his DX. I understand it can be more cumbersome to maintain, but all the files in webpack-entries
should be the same for all templates and the entire folder is easy to replicate.
packages/botonic-cli/templates/childs/webpack-entries/dev-entry.js
Outdated
Show resolved
Hide resolved
5b60bf2
to
0f7618c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this improvement ❤️ 👏!
0f7618c
to
b86455d
Compare
Set as Draft PR if it's not ready to be merged.
PR best practices Reference
Description
As mentioned in the tech daily, applying the trick we did for other providers projects to every template, by adding the corresponding(Ignore commit: 36ea33c)webchat-entry.js
in@botonic/react
src.5.1.1
in@botonic/core
as newer versions> 5.1.1
introduce breaking changes that make webchat to not work.webpack-entries
with every entry file. Then the alias likeBotonicProject
won't be used anymore, so the pipeline is less "magical" (the developer will be conscious that these files are to configure webpack)Context
The expected generated
webchat.botonic.js
after a bot build was larger than expected, causing performance issues (extra download cost when loading the bot code).To document / Usage example
We have to take into account that developers upgrading from older versions than 0.14.0 must add the
webpack-entries
folder to their root project and do the proper modifications in theirwebpack.config.js
.Next steps
Try webpack v5.