Given code like this:
import { el, mount } from \'https://unpkg.com/redom@3.2.1/dist/redom.es.js\';
is there some way to enable subresource
You can use RequireJS, and transpile your code to AMD or UMD to achieve this.
RequireJS has a hook onNodeCreated, which gives you access to the script tag before it is added to document.
You can add the sri attribute onto the script tag:
onNodeCreated: function(node, config, module, path) { node.setAttribute('integrity', integrityForModule); node.setAttribute('crossorigin', 'anonymous'); }
credit: https://stackoverflow.com/a/37065379
I use Webpack (with a target of UMD) and RequireJS.
With the relevant modules put in the external section of the webpack configuration file, so the modules are not compiled into the transpiled code.