Having trouble removing HowlerJS from final compilation

I have a project which uses a library that has the ability to use sound. I want to set a flag so that the HowlerJS code is not included in the final JS output. I thought it could work by setting up a define in the project.xml and then putting conditionals wherever my sound classes might be used.

<define name="silentMode" />

//and then elsewhere:

#if !silentMode
addSubCommand( InitPageSoundsCommand );
#end

Even with full DCE and -final enabled I’m still seeing HowlerJS code in the final file. The extra kilobytes aren’t a huge deal, but I can hear feedback in my speakers because Howler is opening a sound channel for playback. Any ideas? Am I just not applying the conditional compilation in all the right places?

Howler is one thing, but for slimming output, knowing how to conditionally compile without certain lib content would be dandy. In a perfect world, a lack of imports would spell a lack of included code.

For me, I hope HowlerJS is not included in the final code. In this regard, I usually directly restore the old version of tools.n HTML5 platform compilation.

I don’t like using npm to compile html5, because I always download extra npm libraries.

I don’t suppose a good way to do this has emerged yet?

I haven’t figured it yet. I had other fish to fry! Still would be nice to find a solution though.

I had a similar issue with the ‘pako’ library always included, even though I didn’t use compression in my project.
I ended up patching the include.xml file in the lime root folder, and replace
<dependency path="dependencies/pako.min.js" if="html5" embed="true" />
by
<dependency path="dependencies/pako.min.js" if="html5 pako" embed="true" />

2 Likes

I would be open to a pull request that added support for a “lime-exclude-pako” define (and so on) to force these libraries to be excluded and leave it up to the user to include if necessary to prevent runtime errors