I think that's pretty recent? The only way used to be to add a script tag, and 
I have used that in Go before. I think just putting it in as a function call 
might work though...

[Joop Kiefte - Chat @ 
Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=pengd)   
[pengd]

On September 29, 2020 at 12:55 GMT, Eduard Castany <eduard.cast...@gmail.com> 
wrote:

I guess this works on node.js but I was referring to the browser environment. 
Where normal JavaScript can just `import("module")`.

On Tuesday, 29 September 2020 at 11:44:56 UTC+2 Alvadron wrote:

This is what I have been doing and it has worked for my needs:
```
// Importing it using "require" and storing the module in a variable
core := js.Global().Call("require", "@boostercloud/framework-core")

// Now get some props/methods from that module as usual:
config := core.Get("Booster").Get("config")
```
Is this what you were asking about?

El martes, 29 de septiembre de 2020 a las 9:13:03 UTC+1, eduard....@gmail.com 
escribió:

In JavaScript we can 
[import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)
 JavaScript modules statically and dynamically. How could we import a 
JavaScript module dynamically in Go?

The closest/simplest thing may be to add an HTML script tag into the page 
header programatically (and I'm going to try that) but maybe there is a more 
obvious way that I'm not seeing.

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
[https://groups.google.com/d/msgid/golang-nuts/7a8c0562-ec87-47ae-a37e-207ca8a11483n%40googlegroups.com](https://groups.google.com/d/msgid/golang-nuts/7a8c0562-ec87-47ae-a37e-207ca8a11483n%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c-64693-kfo28wdx-8glhrh%3Drdnx29%402.gethop.com.

Reply via email to