vue刷新时报错Uncaught SyntaxError Unexpected token ‘<’
最近nginx里部署vue项目的时候,遇到报错:Uncaught SyntaxError Unexpected token ‘<’
仔细检查我的build配置,发现并没有写错
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
于是观察发现,知识部分路由刷新会报错,检查发现,原来是url里携带了id参数导致报错
{
path: '/singer-album/:id',
component: SingerAlbum
},
{
path: '/song-list-album/:id',
component: SongListAlbum
}
修改传参方式,换成query就不会报错了
{
path: '/singer-album',
component: SingerAlbum
},
{
path: '/song-list-album',
component: SongListAlbum
}