Uncaught syntax error: unexpected token ‘< 0‘

Background

Vue and Vue cli versions for the project

“vue”: “^2.6.11”
“@vue/cli”: “~4.5.0”

I created a static directory in SRC directory to store JS and CSS, and then call it in code.

c.href = '../static/css/he-standard.css';
s.src = '../static/js/he-standard.js';

An error was found after running the project

Uncaught SyntaxError: Unexpected token '<'

solve

Put the static folder under public

c.href = '/static/css/he-standard.css';
s.src = '/static/js/he-standard.js';

Reference:
https://blog.csdn.net/weixin_43742708/article/details/110594790

Read More: