score:2

Accepted answer

webpack bundles your script. this means it encapsulates it from the outer environment. you can't call components or functions without creating a library configuration.

add the following (example) to your webpack configuration:

module.exports = {
  //...
  output: {
    library: 'mylibrary'
  }
};

the variable mylibrary will be bound with the return value of your entry file, if the resulting output is included as a script tag in an html page.

there's even a documentation on authoring libraries.


Related Query

More Query from same tag