Minify help please

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi. I am creating a plugin for c2 but I'm stumbling over how to make it minify-proof. The library that I am using has one line that breaks the dot syntax rule as described here (I think) and I am a little over my amateur-coding head. The function looks like this:

    if (typeof exports !== 'undefined') 
    { if (typeof module !== 'undefined' && module.exports)
      { exports = module.exports = newObjFn({}) }
      else { exports.LibraryName= newObjFn({}) }
    } else {
      if (typeof define === 'function' && define.amd) 
      { define( 'LibraryName',[],function(){return newObjFn({})} ) }
      else //
      { (1,eval)('this').LibraryName= newObjFn({}) }[/code:5hl3oit4]
    
    The last 2 lines need to be fixed (dot syntax is used throughout the rest of the plugin AFAIK).  Can anyone help please?  How can I re-write those last 2 lines so that functionality is retained whilst dot syntax is used instead?
    
    Thanks.
  • Does the plugin cease to work if you minify as it is now? If your plugin is the only js that accesses the library, and you included the library as a dependency then I'd think there was no reason to change anything in the library.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • - thanks for your help. It got me thinking and I did a bit more investigation - I was surprised that the attached library wasn't minified by the export process (is this correct?). When I saw that I realised that the problem was caused by my using dot operators in the runtime.js on functions that required their names to be maintained to access the library. It's all looking good now and as soon as I have a good demo going I'll post the plugin in the other forum. Cheers .

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)