You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
Description
I am using Shiki's code highlighting library to implement code splitting and lazy loading for language lexers and themes. However, despite specifying only one language in the configuration, Shiki is loading all the configured language lexers, leading to unnecessary loading of resources.
Steps to Reproduce
Set up the getHighlighterCore with multiple languages configured as lazy-loadable modules.
Use codeHighlighter function specifying only one language (e.g., 'typescript') to highlight.
Observe that all configured language modules are loaded, not just the one required.
For the code above, I registered many languages, but I only used one.
But it will download all the js files
Expected Behavior
Only the lexer for the specified language should be loaded. For example, if 'typescript' is specified, only the Typescript lexer should be dynamically imported and used.
Or I hope shiki can add automatic language recognition and download lexical js files like prism.
Validations
Describe the bug
Description
I am using Shiki's code highlighting library to implement code splitting and lazy loading for language lexers and themes. However, despite specifying only one language in the configuration, Shiki is loading all the configured language lexers, leading to unnecessary loading of resources.
Steps to Reproduce
Set up the
getHighlighterCore
with multiple languages configured as lazy-loadable modules.Use codeHighlighter function specifying only one language (e.g., 'typescript') to highlight.
Observe that all configured language modules are loaded, not just the one required.
For the code above, I registered many languages, but I only used one.
But it will download all the js files
Expected Behavior
Only the lexer for the specified language should be loaded. For example, if 'typescript' is specified, only the Typescript lexer should be dynamically imported and used.
Or I hope shiki can add automatic language recognition and download lexical js files like prism.
PrismJS/prism#1313 (comment)
Actual Behavior
All lexers specified in the getHighlighterCore setup are being loaded regardless of the language specified in codeHighlighter.
Reproduction
https://github.com/Innei/shiki-bundle-and-import-repro
Contributes
The text was updated successfully, but these errors were encountered: