Can't figure out what's wrong on my project, Chrome Dev Tools returns an error on app.js at line 1:
Uncaught SyntaxError: Unexpected token <
app.js:1
Clicking on error highlight, Developers Tools shows an html code rather the javascript "webpacked" sentences.
Note the src
attribute descripted in the image above, has a bad url:
src="http://localhost:8000/js/app.js/js/app.js"
I supose that would be http://localhost:8000/js/app.js
webpack.mix.js
let mix = require('laravel-mix');
mix
.setPublicPath('public_html/')
.js('resources/assets/js/app.js', 'js')
.js('resources/assets/js/admin/admin.js', 'js')
.sass('resources/assets/sass/app.scss', 'css')
.copy('resources/assets/img', 'img');
app.php
This snippet is added before return $app;
into bootstrap/app.php
file to tell to Laravel that the public folder must be public_html
$app->bind('path.public', function() {
return base_path() . '/public_html';
});
PHP serves the application without errors. The only error is about frontend. Curiously, the css compiled files serves ok and loads right but not like that the app.js script.