ngx-highlightjs icon indicating copy to clipboard operation
ngx-highlightjs copied to clipboard

Move HIGHLIGHT_OPTIONS to sub-entrypoint

Open PieterjanDeClippel opened this issue 8 months ago • 2 comments

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.

PieterjanDeClippel avatar Dec 21 '23 08:12 PieterjanDeClippel

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

MurhafSousli avatar Dec 21 '23 08:12 MurhafSousli

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

PieterjanDeClippel avatar Dec 21 '23 08:12 PieterjanDeClippel

Please try latest version 11

MurhafSousli avatar Mar 29 '24 17:03 MurhafSousli