0

I'm trying to import a 3rd party javascript asset into a ReactJS project. I'm relatively new to React and haven't a need to do this until now (usually everything I need is a npm package and placed in node_modules, however this file does not have an npm package).

I have placed the 3rd party javascript into the /assets/scripts directory, but when I try to import it gives me and error about You attempted to import <file> which falls outside of the project src/ directory. error when compiling.

Is there a reliable way to import a 3rd party javascript file (and supporting css files) within a ReactJS project?

Thanks again!

Sean
  • 2,496
  • 7
  • 32
  • 60
  • Possible duplicate of [The create-react-app imports restriction outside of src directory](https://stackoverflow.com/questions/44114436/the-create-react-app-imports-restriction-outside-of-src-directory) – Akrion Aug 01 '18 at 21:25
  • 2
    Possible duplicate of [How to include a script into my build folder separately?](https://stackoverflow.com/questions/51635815/how-to-include-a-script-into-my-build-folder-separately) – Tholle Aug 01 '18 at 21:26
  • 1
    Throlle's answer was the correct answer for my solution. – Sean Aug 01 '18 at 21:47

0 Answers0