-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Emit ESM build via tsup #5148
Merged
Merged
Emit ESM build via tsup #5148
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Oct 24, 2024
Open
Open
Open
Open
Open
Open
Open
Open
Open
Open
This was referenced Oct 31, 2024
Open
Open
Open
Open
Open
Open
Open
Open
Open
Open
This was referenced Nov 7, 2024
Open
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog Entry
Breaking changes
connect*
,useRenderActivity
,useRenderActivityStatus
,useRenderAvatar
, in PR #5148, by @compulimAdded
moduleFormat
andtranspiler
build info to<meta>
tag, in PR #5148, by @compulimFixed
useNotifications
, in PR #5148, by @compulimDescription
We are adding ES Modules (named exports only) along with CommonJS (both named and unnamed exports).
We expect CommonJS will only used by Webpack 4. And for most web developers who are already using modern pipeline (esbuild, Webpack 5, etc.), they should be using ES Modules.
Design
In our previous citation work, we are adding
valibot
packages. However, this is breakingcreate-react-app
because of CJS/ESM interoperability. To efficiently resolve the issue, we are exporting ESM byesbuild
andtsup
.tsup
also tells us a lot of type portability issues. We are resolving many of them in this pull request.Type portability
Some exported code contains types that are not exported. We deployed 2 strategies:
WebChatAPIContext
should not be exported, but only partial of itWebChatAPIContext
is directly exporting dispatchers from our internal Redux, so we are rewriting the type so it don't need to expose the typing of our internal ReduxUnify exporting types
All types are now exported via
export { type SomeType }
, instead ofexport type SomeType
. Default exports should be reserved for code.Precompiling
globalize
globalize
default use CommonJS/AMD for its runtime. This doesn't play well withesbuild
. We are replacing its code-emitting template to emit solely CJS instead.We also tried to emit ESM but it will call
require()
in some part ofglobalize
. Switching between CJS/ESM is not very foolproof untilglobalize
exports ESM.Emitting instrumentation code
We cannot use
esbuild-plugin-istanbul
because it sometimes not emitting instrumentation code related to JSX.We have to add
@babel/preset-typescript
and@babel/preset-react
beforebabel-plugin-istanbul
.We looked at
@istanbuljs/instrumenter
but printing the code seems more difficult to do than simply running@babel/core/transformAsync
.Version of
@types/react
It is confusing to use
@types/react@18
with[email protected]
. We are unifying all versions to be@types/react@16
instead.Some
FC
/VFC
were removed in favor of newer type signature. SomeSomeComponent.propTypes
andSomeComponent.defaultProps
were also removed.We should do a bigger push to clean up
FC
/VFC
/propTypes
/defaultProps
and mark all props as read-only.Specific Changes
packages/fluent-theme/package.json/main
tobotframework-webchat-fluent-theme.js
fromindex.js
CHANGELOG.md
Review Checklist
Accessibility reviewed (tab order, content readability, alt text, color contrast)CSS styles reviewed (minimal rules, noz-index
)Internationalization reviewed (strings, unit formatting)package.json
andpackage-lock.json
reviewedSecurity reviewed (no data URIs, check for nonce leak)