Importing a module from a js file in public folder #12750
Unanswered
nickgieschen
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have to include an external, minfied js module. E.g. "external/script.js".
external/script.js is:
I have put external/script.js in my public folder.
In public/index.html I have:
<script type="module" src="%PUBLIC_URL%/external/mytest.js"></script>
How can I then import and use mytest in a regular react component? What is the import path I can use for this? I have looked into CRACO and excluding the ModuleScopePlugin, but I'm still not sure how to actually reference the module.
Beta Was this translation helpful? Give feedback.
All reactions