Uncaught SyntaxError: Unexpected token < in chunk.js

Viewed 1450

I need your help please!

I have made deploy and build of aplication. but when i redirect for any page i have this error:

Uncaught SyntaxError: Unexpected token <

I think it was because the browser await .html archive and chunk.js is open like this img

print from error

the route is fine, he finds the route, but don't open file.

before some search i found things like a .htaccess and i have tryied but doesn't works.

i have tryied these two models of .htacess on public/.htaccess

<IfModule mod_rewrite.c>

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]

</IfModule>
Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.html [QSA,L]

but it doesn't works too.

Server

const root = require('path').join(__dirname, 'client', 'build')
app.use(express.static(root));
app.get("*", (req, res) => {
    res.sendFile('index.html', { root });
})

i don't have any webserver, sorry, but im a student, and im still learning...

please help guys!

1 Answers
Related