Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: does not import every langs and themes #93

Closed

Conversation

Barbapapazes
Copy link
Contributor

@Barbapapazes Barbapapazes commented Nov 9, 2023

related to #92 and nuxt/content#2422

I'm trying to avoid the bundling of every themes and langs becuase it makes the shikijs folder, in node_modules, of NItro too heavy.

image

But, even this PR, without loading a theme nor langs, it bundles all of shikijs.

@antfu or @pi0, did you know you we could avoid that?

@pi0
Copy link
Contributor

pi0 commented Nov 9, 2023

This is a nice PR but i'm afraid disabling them by default might not be best decition as this limitation mainly affects edge deployments.

Maybe we can make it behind a syntaXhighlight: 'shiki-lite' mode configuration and auto enable for edge deployments in order to reduce size? (IMO a disabled also would really make sense to allow reducing deployment size when runtiume highlight is not necessary)

@antfu
Copy link
Member

antfu commented Nov 9, 2023

To reduce the bundle size, you need to avoid importing shikiji main entry. Instead, you will need to compose it from shikiji/core shikiji/wasm shikiji/langs/xxx shikiji/themes/xxx and only import what you need staticially.

If we ever need dynamic languages/themes support that means we need to bundle all languages regardlessly.

@farnabaz
Copy link
Collaborator

farnabaz commented Feb 2, 2024

Closing in favor of #129

@farnabaz farnabaz closed this Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants