photopea / UPNG.js

Fast and advanced PNG (APNG) decoder and encoder (lossy / lossless)
MIT License
2.1k stars 259 forks source link

Support es6 modules. #6

Closed backspaces closed 7 years ago

backspaces commented 7 years ago

Please support es6 modules. They are supported, sometimes behind a flag, by all modern browsers. However, the strategy used to be non-trivial, but now is much easier with Rollup: https://medium.com/@backspaces/es6-modules-part-1-migration-strategy-a48de0b7f112

The idea is simple: make your repo es6 module based. Then use rollup to convert to the legacy module formats: iife, cjs (node) and so on.

I converted my repo, basically following Three.js's lead, and have never looked back.

photopea commented 7 years ago

Hi, in my workflow, I don't use any code transformers. The code that I write is exactly the code that is distributed to browsers. So adding modules would interrupt my workflow and I will have to learn to use many new programs. Modules are not enabled in browsers right now.

UPNG.js adds just one single global variable UPNG. If you really need a module, you can rewrite it yourself, I don't plan to update UPNG.js too often (it is a simple library and it seems like it works quite well).

backspaces commented 7 years ago

Agreed.