Closed pindab0ter closed 2 years ago
The packages are distributed in the dist
not lib
directory for this module, please update the import to use the dist
files and let me know if that is still an issue.
This is what I've tried:
import Api from "node-hue-api/dist/esm/api/Api";
import { createLocal } from "node-hue-api/dist/esm/api";
PHPStorm is not aware of any problems, but when I try to build, this is the error I'm getting:
build failed (src/hue/index.ts:3:28 import { createLocal } from "node-hue-api/dist/esm/api";): Could not resolve "node-hue-api/dist/esm/api"
Same goes if I substitute esm
for cjs
.
A workaround is to do this instead, but I'd rather know how to do it without:
import { v3 } from "node-hue-api";
v3.api.createLocal(…);
Specifying Api
as a return type was giving me trouble. The solution was this:
import { discovery, v3 } from "node-hue-api";
import { Api } from "node-hue-api/dist/esm/api/Api";
What threw me off was having to import Api
which was specified in the file Api
which was a part of the folder api
.
I would suggest improving this.
When trying to import
createLocal
it's telling me it can't resolve it:Other imports like
discovery
work fine.