Closed Rstacx closed 11 months ago
If you're running in Node, you'll want to import the node-specific package:
import upscaler from "upscaler/node";
You can check out this example for more guidance.
If you're not in Node then please let me know more information about the environment you're in, the bundler you're using, etc.
Feel free to re-open this ticket with more information about your platform / build setup. Ideal would be to reproduce the issue in a standalone repo or codesandbox example.
When we tried this import Upscaler from 'upscaler/node';
it throws error Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './node' is not defined by "exports" in
@adityapatadia Can you provide a bit more context on your environment?
If you're using import
, I assume you're either using ts-node
or you're using ESM modules in Node.
The node packages only support common js, which means you need to require()
them. I added more context here:
https://github.com/thekevinscott/UpscalerJS/issues/554#issuecomment-1344108954
If you're using ts-node, I believe there is a tsconfig setting I can try and dig up that enables cross-compatibility (so you can do an import on a CJS module).
If you are trying to use ESM modules, let me know. I made an issue to add support for ESM in node here (https://github.com/thekevinscott/UpscalerJS/issues/671) but dropped it as I got the sense it wasn't in high demand. If it's something you need I can pick it up again.
We are using ESM on nodejs. Require does not work there and there does not seem to be a workaround.
@adityapatadia let's move this comment thread to #671
When I imported the upscaler package and started it, I got this error Please tell me how to fix this
import upscaler from "upscaler";