szdc / tiktok-api

Unofficial API wrapper for TikTok
MIT License
1.27k stars 278 forks source link

Error while importing getRequestParams #35

Closed shashank0708 closed 5 years ago

shashank0708 commented 5 years ago

I am running the app like this:- node --experimental-modules index.mjs

and this is line is giving error
import TikTokAPI, { getRequestParams } from 'tiktok-api';

error:-

(node:5872) ExperimentalWarning: The ESM module loader is experimental.
TypeError: getRequestParams is not a function
    at file:///D:/Node.js/FirstTry/index.mjs:14:16
    at ModuleJob.run (internal/loader/ModuleJob.js:97:14)
    at <anonymous>

P.S I am new to node.js.

lijuanliu2018 commented 5 years ago

Hi, @shashank0708

How do you fix this? We meet the same issue.

szdc commented 5 years ago

@lijuanliu2018 ECMAScript Modules are still experimental so I'm not inclined to invest into resolving this. Use Babel, TypeScript, etc. if you want this functionality now.

Alternatively, you are able to work around this by simply using the default export:

import TikTokAPI from 'tiktok-api';

const requestParams = TikTokAPI.getRequestParams({...});