在子路径级别的Traefik中设置2个Vue.js应用程序时出错
我想为Vue.js中构建的两个应用程序提供服务,它们都位于domain.com/apps/tentles/和domain.com/apps/football这样的子路径/ 这两项服务都是在Traefik背后提供的,规则如下:在子路径级别的Traefik中设置2个Vue.js应用程序时出错,vue.js,traefik,Vue.js,Traefik,我想为Vue.js中构建的两个应用程序提供服务,它们都位于domain.com/apps/tentles/和domain.com/apps/football这样的子路径/ 这两项服务都是在Traefik背后提供的,规则如下: Host(`domain.com`) && PathPrefix(`/tennis/`) --> Frontend tennis application Host(`domain.com`) && PathPrefix(`/footb
Host(`domain.com`) && PathPrefix(`/tennis/`) --> Frontend tennis application
Host(`domain.com`) && PathPrefix(`/football/`) --> Frontend football application
我使用vue router,并在各自的router.js中为这两个应用程序设置如下:
const router = new Router({
mode: 'history',
base: '/apps/tennis',
linkActiveClass: 'active',
linkExactActiveClass: 'exact-active',
scrollBehavior() {
return { x: 0, y: 0 };
},
routes: [
{
path: '/',
redirect: '/home',
},
{
path: "/home",
name: "home",
component: () => import("./views/Home"), // show tennis application home page
}]
});
const router = new Router({
mode: 'history',
base: '/apps/football',
linkActiveClass: 'active',
linkExactActiveClass: 'exact-active',
scrollBehavior() {
return { x: 0, y: 0 };
},
routes: [
{
path: '/',
redirect: '/home',
},
{
path: "/home",
name: "home",
component: () => import("./views/Home"), // show football application home page
}]
});
两个应用程序都有vue.config.js:
module.exports = {
publicPath: '/tennis/'
};
module.exports = {
publicPath: '/football/'
};
两个应用程序均未加载到浏览器上,我看到以下错误:
Uncaught SyntaxError: Unexpected token '<'
Uncaught SyntaxError:Unexpected token“您的路由的基本路径为/apps/
,但您的配置的公共路径为/
,那么是哪一个呢?这是我的困惑,即路由和配置中的用法和差异。我希望它是/apps/
,那么为什么不在任何地方都使用它呢?为什么要使用非/apps/
前缀路径?我将base、publicPath和traefik规则更改为/apps/
。我仍然收到错误,因为Uncaught SyntaxError:Unexpected token'可能会COPY--from=build stage/app/dist/usr/share/nginx/html
from applications Dockerfile导致任何问题吗?