2

I am trying to use the following external component in my React project. My project is not based directly on the npm ecosystem (I am using react-dom), so I have been trying to import the component using a static compiled JavaScript file with a regular script tag in my html.

The file generated by the build seems to be a JavaScript UMD. I have tried to load this module using RequireJS, but I have been having the problem described here.

I'm not really sure whether I am approaching this correctly. I know that Browserfy performs similar functions to RequireJS, but I'm not even certain whether I should be pursuing this as a possible avenue.

What is the canonical way to load a component like this into the browser?

This question may be a duplicate of this similar question, but it does not have any real answers.

Regan Koopmans
  • 451
  • 6
  • 16

1 Answers1

0

For reference, I found that this can be done using existing libraries, such as https://github.com/revolunet/react-umd-loader . Even if the libraries themselves are somewhat deprecated, the techniques used are still relevant.

Regan Koopmans
  • 451
  • 6
  • 16