Skip to content

Performance: Resolve severe TTI delays by lazy-loading the Prism.js syntax highlighting engine #615

Description

@pradeep0153

Description

Google Lighthouse profiling reveals a severe Time to Interactive (TTI) penalty caused by a massive JavaScript bundle size. The platform is currently importing the entire Prism.js (or highlight.js) syntax highlighting library synchronously in the main bundle to style code blocks within repository READMEs. This forces every single visitor to download and parse 150kb+ of heavy JavaScript before the page can become interactive, even if the user's README doesn't contain a single line of code.

Proposed Solution

  • Audit the global Webpack/Vite bundler configuration and the <MarkdownRenderer /> component.
  • Surgically remove the synchronous import of the syntax highlighting library.
  • Implement dynamic, asynchronous imports (e.g., React.lazy() or standard import()).
  • The syntax highlighting library should only be fetched from the network if and only if the markdown parser explicitly detects a ``` code block within the README payload.
  • This architectural upgrade drastically slashes the initial JavaScript bundle size, massively accelerating the Time to Interactive (TTI) and significantly boosting the Lighthouse performance score for all portfolios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions