Is there an existing way to resolve a remote url? Such as:
require(['http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'], function(jquery) {
$('body').html('It works!')
})
If not, I was going to attempt to write a plugin for it. Where it just bundles a call to asynchronously load the remote resource. Just wanted to check to make sure a solution doesn’t already exist. Thanks!
see #150
@giovannipds srciptjs is not support amd’s require , god
@jlianphoto what? I don’t know if I’m getting what you meant, how doesn’t it, if it is working with commonjs’ require? Why wouldn’t it? Looking at the repo, it seems there’s a commit 6 years ago (on
Makefile
), commited as … anyway…Even though, my question was, if, is there a better approach nowadays, instead of
scriptjs
?Oh, here we go: https://www.npmjs.com/package/webpack-require-http @giovannipds
This should interest you.
This is an updated library.
LoadJS is based on the excellent $script library by Dustin Diaz. We kept the behavior of the library the same but we re-wrote the code from scratch to add support for success/error callbacks and to optimize the library for modern browsers. LoadJS is 789 bytes (minified + gzipped).
https://github.com/muicss/loadjs
Can we use just a native dynamic
import
for such cases?Here we go!! thank you @sviatoslav-lebediev – check out master branch for and youll see how i implemented your idea
Using
new Function
to get around webpack or babel from mutatingimport()
when in a library, usingdimport
to polyfill dynamic imports, lastly using load.js for CORS imports or ooold school importingScriptedAlchemy/webpack-external-import#38
https://github.com/ScriptedAlchemy/webpack-external-import