I have been writing an isomorphic library i.e one that runs in browser and node.
For the most part, I had to duplicate files as in file.node.js
, file.browser.js
, even though they did the same task.
The reason for this duplication was @tensorflow/tfjs-node
.
However, I am reading the spec for the browser,
and if we add this to package.json:
{
browser: {
"@tensorflow/tfjs-node":false
}
}
Then I think we could just avoid splitting code, however, I wonder this, could I import both ? Like so:
import * as tf from "@tensorflow/tfjs"
import "@tensorflow/tfjs-node"