coderaiser / minify

Minifier of js, css, html and img
https://coderaiser.github.io/minify
MIT License
228 stars 29 forks source link

Convert to ESM #74

Closed coderaiser closed 2 years ago

coderaiser commented 3 years ago

Would be amazing to convert minify to ESM. @putout/plugin-convert-commonjs-to-esm can help with it.

Zapotoczny-Rafal commented 3 years ago

Hello @coderaiser, I would like to contribute to this issue, but i don't promise i'll do it correctly the first time

Zapotoczny-Rafal commented 3 years ago

Hi @coderaiser, I'm done converting this, but there is one problem with the for loop

for (const name of ['js', 'html', 'css', 'img']) { minify[name] = require(DIR + name);

I have not found information on how to convert it to the esm module, so I changed these four files to commonjs with .cjs extension. Can it be like that?

coderaiser commented 3 years ago

You can use dynamic import for this purpose

coderaiser commented 2 years ago