In my project, I am trying to include an .js file, but it is displaying the error Uncaught SyntaxError: Unexpected token <
every time I include the file as <script type="text/javascript" src="dashboard/dist/js/main.js"></script>
. It turns out that this problem only exists when I'm calling my main library that way.
<?php require "lib/Url.class.php"; ?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<meta http-equiv='X-UA-Compatible' content='IE=edge'/>
<title>Dashboard - Marketing</title>
<meta name='viewport' content='width=device-width, initial-scale=1'/>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css'/>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E=" crossorigin="anonymous"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js'></script>
<script type="text/javascript" src="dashboard/dist/js/main.js"></script>
<link href='https://fonts.googleapis.com/icon?family=Material+Icons' rel='stylesheet'/>
</head>
<nav class="nav-extended #0d47a1 blue darken-4">
<div class="nav-wrapper container">
<a href="#" class="brand-logo">Logo</a>
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a class="nav-link text-white" href="<?php echo URL::getBase(); ?>main">Home</a></li>
<li><a class="nav-link text-white" href="<?php echo URL::getBase(); ?>dados">Dados</a></li>
<li><a class="nav-link text-white" href="<?php echo URL::getBase(); ?>precos">Preços</a></li>
</ul>
</div>
</nav>
<ul class="sidenav" id="mobile-demo">
<li><a class="" href="<?php echo URL::getBase(); ?>main">Home</a></li>
<li><a class="" href="<?php echo URL::getBase(); ?>dados">Dados</a></li>
<li><a class="" href="<?php echo URL::getBase(); ?>precos">Preços</a></li>
</ul>