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

Move HIGHLIGHT_OPTIONS to sub-entrypoint #277

Conversation

PieterjanDeClippel
Copy link

The HIGHLIGHT_OPTIONS provider must always be provided at the root. Because of this, the entire ngx-highlightjs library is bundled into the main bundle, even when it's only being used on a page

image

This PR moves the provider to a seperate entrypoint, causing the rest of the library to be tree-shakable.

@MurhafSousli
Copy link
Owner

It should be tree shakable the way it is! in which environment you run your test?

@PieterjanDeClippel
Copy link
Author

PieterjanDeClippel commented Dec 21, 2023

Thanks. I'm not using the HighlightModule on the AppComponent but on a page that's lazy-loaded. However, we must configure the HIGHLIGHT_OPTIONS at root level. Because everything resides in the same library entrypoint, it's all being bundled together.

Here's the place where I use the HighlightModule. This component is being used on this page (lazy-loaded). The HIGHLIGHT_OPTIONS is provided here, so the main entrypoint is bundled in the main-bundle

image

@MurhafSousli
Copy link
Owner

Please try latest version 11

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

2 participants