zebzhao / indent.js

Pure code indentation for jsx, tsx, ts, js, html, css, less, scss.
https://zebzhao.github.io/indent.js/
MIT License
76 stars 8 forks source link

indent.html does not exist when using es modules #19

Open Pomax opened 4 years ago

Pomax commented 4 years ago

running this in node 14:

import indent from "indent";

export default async function processfile(data) {
  return indent.html(data);
}

errors out going

(node:6724) UnhandledPromiseRejectionWarning: TypeError: indent.html is not a function
    at ....

So that's literally useless? =(

dwjohnston commented 3 years ago

You need to import

import { indent} from "indent";
Pomax commented 3 years ago

@zebzhao can you update the README with that? Right now it's telling folks to use the wrong import:

image

aral commented 1 year ago

This appears to be fixed in that import indent from 'indent.js' works and import { indent } … results in undefined now.