1

I'm trying to add external javascript to my React project.I have a Footer.js component where I add my javascript files. I'm using the react-helmet library.

class Footer extends Component {

    render () {
        return (
        <div>
            <Helmet>
                <script src="../../assets/scripts/main.js" type="text/javascript" />

                <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
                <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
                <script src="https://cdn.jsdelivr.net/npm/metismenu"></script>
            </Helmet>
        </div> 
        );
    }
}

It is returning a warning in the browser:

The script from “http://localhost:3000/assets/scripts/main.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.

It is clearly a JavaScript file, why is it saying that the type is "text/html"?

Thanks

myTest532 myTest532
  • 2,091
  • 3
  • 35
  • 78

0 Answers0