image: load image using Node.js/webpack custom ESModule
Closed this issue · 4 comments
yorkie commented
See https://nodejs.org/dist/latest-v15.x/docs/api/esm.html#esm_https_loader, Node.js is able to add a custom loader for ESM sugar, and boa is also using it to load Python module:
import tensorflow as tf from 'py:tensorflow';
Just figure it out that we are able to read an image in the same way:
import yorkie from 'datacook:/path/to/a/dog.png';
console.log(yorkie); // should be an instance of `datacook.Image`
yorkie commented
The same for tabular and text-related resources, too.
WenheLI commented
IMO, this syntax may not be compatible with browser env.
We should keep the experience of browser and node as same as possible.
yorkie commented
Hmm, IMOH it's compatible with ESM, which is supported by both Node.js and browser :)
yorkie commented
Closing because of inactive.