Technically, yes you can, but it’s not going to be as easy as going with the npm flow and using a bundler.
import * as React from "react";
(If using ES6 module style.)
If using a CDN you would probably want an output that looks like this:
import * as React from "https://some.cdn/react";
The syntax (from the ReasonReact repo) that controls the output JS is:
[@bs.module "react"] external createElement: (component('props), 'props) => element = "createElement";
If you changed it to:
[@bs.module "https://some.cdn/react"] external createElement: (component('props), 'props) => element = "createElement";
…then you’d get the desired output. But the problem is then you need to change the sources … i.e. maintain or find forked bindings for React for that CDN. Or set up some code automation that does a find-and-replace of
[@bs.module "react"] with
[@bs.module "https://some.cnd/react"]. So either way, it’s not as simple as using a bundler.
CLICK HERE to find out more related problems solutions.