New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What's the right way to include inline JS from remote sources? #1658
Comments
You might
|
@chinedufn The first link is quite useful! Tho, what I need is to download the script if it's remote. So, by doing |
@IonicaBizau ahh gotcha So sorry if I'm misunderstanding, but are there any issues with downloading the script and then adding it to the bundle? i.e.: require('xhr').get('https://example.com/foo.js', function (err, resp) {
if (err) { throw(err) }
var myScript = resp.body
b.add(myScript)
}) |
@chinedufn Oh, so, can we simply I'll try it. |
Thanks! 🍰 |
Gah I think it might only work with paths as you said. @terinjokes do you know if there's a reason for this? @IonicaBizau in the meantime maybe just |
@chinedufn Correct, but I was thinking there is a transform for that, something similar to this: https://github.com/dsdenes/browserify-cdnjs While that looks good for |
@IonicaBizau ah cool, gotcha gotcha I just searched "browserify load script" on node-modules.com and came across bromote Might that be of any use? |
Browserify allows you to feed in streams when you call methods like add. From front readme:
|
How can I include a remote script in the bundle? Similar to the
inline
@import
from less.The text was updated successfully, but these errors were encountered: