Deep-import LightAsync to improve module-import time in tests
`LightAsync` is a `react-syntax-highlighter` that defers the computation of some fancy syntax-parsing logic. However, `react-syntax-highlighter` exposes a `Light` variant that does this computation up-front. In runtime, tree-shaking ensures that we only import `LightAsync`, but tree-shaking doesn't happen in tests (because it's slow). So, deep-import to avoid incurring the syntax-parsing penalty when that functionality isn't used in the test itself. Signed-off-by: Mitchell Hentges <mhentges@spotify.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/core-components': patch
|
||||
---
|
||||
|
||||
Deep-import LightAsync component to improve module-import speed
|
||||
@@ -18,7 +18,8 @@ import React from 'react';
|
||||
import { useTheme } from '@material-ui/core/styles';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import { CopyTextButton } from '../CopyTextButton';
|
||||
import { LightAsync } from 'react-syntax-highlighter';
|
||||
import type {} from 'react-syntax-highlighter';
|
||||
import { default as LightAsync } from 'react-syntax-highlighter/dist/esm/light-async';
|
||||
import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/dark';
|
||||
import docco from 'react-syntax-highlighter/dist/esm/styles/hljs/docco';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user