EES-5539 Fix excessively large CodeBlock
dependency bundle
#5295
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 fixes the
CodeBlock
component importing the entirety of Highlight.js and creating excessively large bundles.We've now stripped this down to the bare minimum and only import in the languages that we need (i.e. R and Python).
As part of this, we've also swapped out the current colour theme for the same one that's used by the GOV.UK Design System (which appears to be based on GitHub's). We've also made some improvements to make most of the colours WCAG AAA colour contrast compliant.
The colours now look like:
Related changes
CodeBlock
props to improve type-safety and replacedcode
prop withchildren
to be more idiomatic.build:analyze
script that can be ran from the frontend project to analyze its bundles using@next/bundle-analyzer
.