OP-Engineering/link-preview-js

SyntaxError: Cannot use import statement outside a module since version 2.1.1

KosGrillis opened this issue · 2 comments

Describe the bug
I'm getting the following build time error when attempting to use the package in a locally running node app:

/node_modules/link-preview-js/build/index.js:10
import cheerio from "cheerio-without-node-native";
^^^^^^

SyntaxError: Cannot use import statement outside a module

Initially I thought it was my config but rolling back to version 2.1.0 (the one with the security issues) works fine. This leads me to believe that its something to do with the internal usage of Cheerio.

ah, I changed the transpilation target to ES6 since most node environments support ES6 syntax, which version of Node are you running? also bear in mind if you are not using 12+ you are probably going to run into troubles soon since it is reaching end of support

Version 2.1.3 is released, I've reverted the compilation target to ES5 and you should not face troubles with modules anymore