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.
This PR adds source map support to the Chainlit frontend and the react-client library.
Source maps make debugging easier, particularly in production environments. They allow you to debug pre-compiled code without needing to deploy a debug version or run Chainlit from the source code.
This PR enables source map generation as separate files, ensuring it does not affect the resulting bundle, package, or wheel size, except for a single line added at the end of each file to reference the corresponding source map file.
You can learn more about source maps here and the settings used here and here.
After this PR, the build system may generate numerous warnings about missing source maps and incorrectly (though this doesn't seem to have much impact) add the source map link to files twice, with the wrong file name the first time (
out.js.map
instead ofindex.js.map
).The first issue can be resolved by upgrading to
vite-plugin-react-swc
version 3.7.1 or later, and the second by upgradingtsup
to version 8.1.2 or later.Unfortunately, I wasn't able to get source maps working for
libs/*
when they are included in thefrontend
app compiled in production mode. This seems to be an issue with Vite/React/SWC, as it affects all dependencies, not justlibs/*
. However, source maps forlibs/*
are generated correctly and can be used in other apps that depend on these libraries.Feel free to edit this PR if needed as I allowed edits by maintainers.