Conversation
56dc8d2 to
59b2eec
Compare
79e4a3d to
737339a
Compare
|
node-datachannel requires esm modules, moving it #652. |
There was a problem hiding this comment.
Looks good!
I've quickly tried to import and use Transformers.js but I get an import error.
It's the same as in this stackoverflow post, which is answered by Transformers.js's author
Following the answer I can circumvent the issue like that:
const TransformersApi = Function('return import("@xenova/transformers")')()
const { AutoTokenizer } = await TransformersApi
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/bert-base-uncased')
const { tokens } = await tokenizer('I love transformers!')The Function import triggers a linting error and honestly looks quite hacky
What do you think? I'm bringing this up here in case we need to change things before merging
haa, welcome to the ESM (ECMAScript Module) world! this error means that node is trying to read an ESM module as a CommonJS one (old node-specific module system). to be able to load it, we need ESM support (which requires to change typescript target & module to be at least ES2015). and that's what I'm trying to fix with #652.
this is indeed quite hacky, does it work at all? |
currently, we're running with node 16, which is not LTS anymore. some packages requires newer nodejs,
wrtcis dead (and not compatible with node 16 anyway), so upgrading is needed.