Babel react to Vanilla js

Viewed 19

I have a code on react that I would like to convert in vanilla js due to client environment issue. The import library function is replaced with script tag but i am using dat.gui library which is called in the following way

    import { GUI } from 'dat.gui/build/dat.gui.js'

And further on used like following

const CTRL = new GUI()
    CTRL.add(CONFIG, 'show')
      .name('Show Audio')
      .onChange(show => (AUDIO.style.display = show ? 'block' : 'none'))

I have converted the above library import code as following but I am getting GUI undefined.

        const GUI_Script = document.createElement('script');
    GUI_Script.setAttribute('src','dat.gui/build/dat.gui.js');
    document.head.appendChild(GUI_Script);

CONSOLE ERROR

0 Answers
Related