indent.js icon indicating copy to clipboard operation
indent.js copied to clipboard

indent.html does not exist when using es modules

Open Pomax opened this issue 5 years ago • 3 comments

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? =(

Pomax avatar Aug 11 '20 01:08 Pomax

You need to import

import { indent} from "indent";

dwjohnston avatar Dec 22 '20 02:12 dwjohnston

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

image

Pomax avatar Dec 23 '20 00:12 Pomax

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

aral avatar Mar 17 '23 12:03 aral