Closed D-saif closed 1 year ago
sorry but no...
look at the index.ts:
import { proxmoxApi } from './constructor';
export { proxmoxApi } from './constructor';
///
///
///
export default proxmoxApi;
proxmoxApi is exported twice:
proxmoxApi
(first line)default
(last line)so the 2 syntax works, but the old one is 4 for char shorter.
the next PR may be the right one :)
import proxmoxApi from "proxmox-api";
is an alias for:
import { default as proxmoxApi } from "proxmox-api";
Because when I install the package then execute the sample in a test.js file with node I got this error:
TypeError: proxmoxApi is not a function
at test (file:/test.js:8:20)
at file:/test.js:29:1
at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
while after adding the curly brackets in the import line it works fine.
Please tell me if I am missing anything since I am a newbie to JS/TS
yep, there was an error in the readme, thx for the notice.
I think you should import the function itself from the package proxmox-api