question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

auto-minification issue with ionify

See original GitHub issue

The github auto-minification instructions

Add “.min” to any JS/CSS file to get a minified version - if one doesn’t exist, we’ll generate it for you. All generated files come with source maps and can be easily used during development:

https://cdn.jsdelivr.net/gh/jquery/jquery@3.2.1/src/core.min.js Minifying a large file can take several seconds. However, we store all generated files in our permanent storage, so this delay only applies to the first few requests.

don’t work with these javascript files

jsdelivr returns this essentially similar message with no content for both

/**

  • Minified by jsDelivr using Terser v3.14.1.
  • Original file: /gh/ionify/ionify@public/web.js
  • Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ //# sourceMappingURL=/sm/88df9541de928e9d732efbd81ac4471116db80dcfc4c3e43e6c56fb97f5eeecd.map

The original files each load correctly from jsdelivr without the .min.js option and when combined via

https://cdn.jsdelivr.net/combine/gh/ionify/ionify@public/web.js,gh/ionify/ionify@public/ions/on.ion.js

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
iskitzcommented, Apr 11, 2020

Great points re: security & the likelihood of files already being minified if their package contained a config file. I didn’t consider that and agree that it’s probably simpler to have ionify do its own minification so I’ll look into automating that via Github.

I was, and still am excited about jsDelivr’s zero-config on-demand & persistent file minification & combination. I find those features really convenient & helpful for performance, and now expect them from top-tier cdns.

I’m still concerned about Terser’s compression operation and think it’s important to confirm why the sequences compress option causes the code omission problem I’m seeing. I’ll look into that and file a Terser issue if it’s indeed a bug in their compression process.

1reaction
MartinKolarikcommented, Apr 11, 2020

That’s rather weird, based on what that option is for, I wouldn’t expect it to make a difference in what code is dropped.

Regarding the author-defined config, I don’t think this is something we could do in the near future.

First, it’s a potential security problem and would need to be examined and implemented carefully.

Second, if a package contained the config file, it would almost always contain the minified files as well. The only exception would be if the author specifically relied on jsDelivr to generate the files but needed to change the config, as in your case. However, this is a very rare case and since author’s involvement is needed anyway, they may just ship the minified files themselves. The main point of auto minification is that’s it’s zero config and you can use it even when the author doesn’t want/care to ship the minified files.

I do think it makes sense to examine the compress option and if there’s something that might improve compatibility without significantly affecting the size, we could change it. But in your case it might just make more sense to setup a GH action to automatically minify and publish the files to npm or another GH branch or repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found