sindresorhus / capture-website

Capture screenshots of websites
MIT License
1.93k stars 137 forks source link

Import error with ts-node #87

Closed kaihaase closed 3 years ago

kaihaase commented 3 years ago

I import capture-website (i2.0.2) in a TypeScript project via: import captureWebsite from 'capture-website';

When starting the application via ts-node (10.0.0) I get the following error message:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ... /node_modules/capture-website/index.js
require() of ES modules is not supported.

I tried it in the following Node.js versions on macOS (11.4):

I also tried to import via: import * as captureWebsite from 'capture-website';

sindresorhus commented 3 years ago

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c