Possible way to ease the tensorflow support for node and web in a single script?

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"

Actually I have done all the changes from the post, and it seems to run fine.

Probably also needs disabling some eslint rule if you have some.

Would love some feedback. @chunduriv @Jason