ES6 import use with external link

Is there a way to use a direct link in import tag like:

import * as THREE from ‘https://github.com/mrdoob/three.js/blob/38bf141e60239ffa56b8f32dba80c465711ac486/build/three.module.js’;

If i run the script with this type of import, i get “Access to script at ‘access-control-allow-origin: https://github.com/mrdoob/three.js/blob/38bf141e60239ffa56b8f32dba80c465711ac486/build/three.module.js’ from origin…etc” error

Yes, but not from GitHub. Various other CDNs like jsdelivr and unpkg are available:

https://unpkg.com/three@0.115.0/build/three.module.js

1 Like