-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Labels
Description
I noticed a very weird bug. When importing htmlnano
as an ESM module (import htmlnano from 'htmlnano'
) everything works well. But when importing as a CommonJS module (const htmlnano = require('htmlnano')
), some minificators fail.
Here is an example:
const fs = require('fs');
const htmlnano = require('htmlnano');
const html = fs.readFileSync('./w3.org.html', 'utf8');
console.log(html.length);
// Shows 50000
htmlnano.process(html).then((result) => {
console.log(result.html.length);
// Shows 49834
});
import fs from 'fs';
import htmlnano from 'htmlnano';
const html = fs.readFileSync('./w3.org.html', 'utf8');
console.log(html.length);
// Shows 50000
htmlnano.process(html).then((result) => {
console.log(result.html.length);
// Shows 39557
});