skip to Main Content

Is it possible to load a remote js file through the script tag and treat it as React component.

Assuming that I build a project that contains a react component:

<ExampleComp var={value} />

And I am accessing the bundle js file (built from the other project ) in the destination project:
<script type="text/javascript" src="/path/to/script.js"></script>

In the destination project, is it possible to treat the component included in the bundle js file as a react component such that I can interact with it like a normal React component:

<ExampleComp var={value} />

2

Answers


  1. A quick search lead me this repository, maybe it can help you?
    Looks to do more or less what you are asking for.

    https://github.com/Paciolan/remote-component

    Login or Signup to reply.
  2. maybe it can help you? tsconfig reference

    https://www.typescriptlang.org/tsconfig/#references

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search