Home

Issue: 1106

Load component from <script> tag

[issue link]

Hi. is it possible to load component from script tag ?
I am building nw.js app on client side & using nuxt on server side.
This app needs to load compiled v8 snapshot within xhr response using nw.Window.get().evalNwBin().
In regular html it looks like this:

<html>
<head></head>
<body>
<script>
var url = "/myComponent.bin";
var xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer'; // make response as ArrayBuffer
xhr.open('GET', url, true);
xhr.send();
xhr.onload = () => {
  // xhr.response contains compiled JavaScript as ArrayBuffer
  nw.Window.get().evalNWBin(null, xhr.response);
}
</script>
</body>
</html>

or is it possible to use component that loads like:

<script type="text/javascript" src="/mycomponent.js"></script>

Thanks.

This question is available on Nuxt.js community (#c973)