Refresh 404 after packaging Vue project, uncaught syntax error: unexpected token <

The login page can be accessed normally, and the menu can be accessed normally. Once the page is refreshed, it will be blank or not easy to make
at the same time, the console will report an error: unexpected token & lt;

This is because refreshing the page needs to re request the JS file, but the path has changed when the request is made, and the content of index.html is requested back

in Vue config – & gt; In index.js bulid,
configure assetspublicpath as the absolute path of your static resources. How to refresh this path will not change

build: {
    // Template for index.html
    index: path.resolve(__dirname, '../nqia-ias/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../nqia-ias'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/s/nqia-ias/',

Read More: